maxlath / wikibase-cli

read and edit a Wikibase instance from the command line
MIT License
226 stars 24 forks source link

`wikibase-api-not-recognized-language` when trying to copy entities from Wikidata #188

Closed m90 closed 1 month ago

m90 commented 1 month ago

I'm trying to provide some scaffolding for an empty wiki by copying over entities from Wikidata. The command I am running is

wb data P22 P25 P40 P18 P31 P279 Q1 Q2 Q64 Q42 Q3107329 --instance https://www.wikidata.org |\
  jq --compact-output '{type,labels,descriptions,aliases,datatype}' |\
  wb create-entity --batch --instance https://mywiki.example.org

which gives me

{
  "name": "wikibase-api-not-recognized-language",
  "parameters": [],
  "html": {
    "*": "The supplied language code was not recognized."
  }
}

Is there any way I can work around this, or any way I could find out which language code is the offending one? I tried some jq magic that matches the contentlanguages for target and source instances, but this lead nowhere either.

The version I am running is 17.0.8.

m90 commented 1 month ago

FWIW the issue also persists when updating the version in use to 18.0.3

maxlath commented 1 month ago

It looks like a Wikibase issue, namely https://phabricator.wikimedia.org/T236177, more that a wikibase-cli one: one of the languages used in P22 P25 P40 P18 P31 P279 Q1 Q2 Q64 Q42 Q3107329 terms is likely missing on your Wikibase instance.

m90 commented 1 month ago

So what I came up with for now is a script that queries the target wikis for wbcontentlanguages and then will strip the ones that are not included: https://github.com/wbstack/transferbot/blob/a7bb0b17e0046e691fb6d8de458006125ed84c97/mangle_data.py