Page MenuHomePhabricator

Errors when saving monolingual text property on Wikidata if other text with the same language exist
Open, MediumPublic

Description

I was trying to add two common names to Q28773023 wikidata item for white monarch butterflies. The first one ("white morph of the monarch butterfly") saved properly, but when saving the second ("white monarch") I got en error "Could not save due to an error. "e" is not a known language code." Please see screenshots:

  • Before
    New Picture (13).png (621×938 px, 28 KB)
  • After
    New Picture (14).png (610×948 px, 27 KB)

I eventually saved one as "British-english"

Event Timeline

I see that User:GZWDer managed to change "British-english" to "English". The "after" screenshoot was taken today using Firefox 50.1.0 and vector skin. Originally when I created the second property with the same language the "Save" button was not active, so I changed it to "British-english" and back to "English" (without saving), this time "save" was active but gave me the above errors.

This looks like the same thing I mentioned in T110043#2083784. I don't think it has anything to do with there being an existing statement with that language code, because the language code it is trying to use ("e") is not even a valid one. I haven't found a way to reproduce it, it just sometimes doesn't seem to notice that the text in the language field has changed and tries to use old or incomplete language codes.

I just got this again. I wrote "mok" and clicked on "Moksha (mdf)" and when I tried to save, it said Could not save due to an error. "mok" is not a known language code., even though the language field said "Moksha (mdf)". I tried saving again and got the same error, so I went back to the language field, deleted the "Moksha (mdf)" text, typed "moksha" and clicked on "Moksha (mdf)" again and then it finally let me save it.

Just tested it and I didn't have this problem: https://www.wikidata.org/w/index.php?title=Q4115189&oldid=489021289
So probably a Javascript issue. Could you check if any errors occur in your browser console when you try to add a monolingual value?

I don't get any errors when it works. I don't know how to reproduce it (as I wrote above) but when I see it again I'll try and remember to check.

Oh, typical, as soon as I write that, my next test reproduces it.

This time, I edited the last statement I added (this statement). I changed the text from "a" to "asdf", deleted Moksha as the language, pressed "e", clicked on "Emiliano-Romagnolo (eml)", tried to save and got Could not save due to an error. "e" is not a known language code.. There weren't any errors in the console.

I did look at the network requests and noticed that there was a request which used the code eml (wbparsevalue, I think, because there was a warning "The parameter "parser" has been deprecated.") followed by a POST to api.php which used e as the code. Unfortunately I accidentally clicked on a link, lost the network request history and now I can't reproduce it again, so that's all I know.

This happens occasionally to me as well, but with "pt-BR". Sometimes it seems like it's due to the page not finishing loading before I try to save the edit, but I'm not sure about that.