Page MenuHomePhabricator

cxserver: en > qqq pair should not be used for requests
Open, In Progress, MediumPublic2 Estimated Story PointsBUG REPORT

Description

In the cxserver logs, the following frequent logs are seen:

Adaptation error for content: en > qqq. HTTPError: 503: MW API error from URL: http://localhost:6500/w/api.php?format=json&action=wbgetentities&props=labels&ids=Q629%7CQ23809&languages=qqq&redirects=yes: api_error
    at WikidataRequest.mwGet (file:///srv/service/lib/mw/MwApiRequest.js:116:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)

Full log: https://logstash.wikimedia.org/app/dashboards#/doc/0fade920-6712-11eb-8327-370b46f9e7a5/ecs-k8s-1-1.11.0-7-2025.46?id=TTGle5oBlLUf3R62ytG0

Adaptation error for content: en > qqq. HTTPError: 503: MW API error from URL: http://localhost:6500/w/api.php?format=json&action=query&meta=siteinfo&siprop=general%7Cnamespaces%7Cnamespacealiases%7Cspecialpagealiases&formatversion=2: api_error
    at MWApiRequest.mwGet (file:///srv/service/lib/mw/MwApiRequest.js:116:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)

Full log: https://logstash.wikimedia.org/app/dashboards#/doc/0fade920-6712-11eb-8327-370b46f9e7a5/ecs-k8s-1-1.11.0-7-2025.46?id=_zWlepoBFM-LSVmLcHn-

It may be used for testing or by a script. If possible, we should avoid it to help filter the production logs.

Event Timeline

abi_ set the point value for this task to 2.
abi_ moved this task from Backlog to In Progress on the LPL Essential (FY2025-26 Q2) board.
abi_ triaged this task as Medium priority.Nov 14 2025, 6:18 AM

Looking at the code in the Translate extension, we request for supported MT language pairs before making requests so these requests to qqq are not originating from there.

I see that qqq is used in the spec.yaml file multiple times: https://github.com/wikimedia/mediawiki-services-cxserver/blob/master/spec.yaml#L189, and I assume this is where these requests are coming from.

The code in the translate method tries to perform adaptation of the content even if the language pair provided is not valid. Even if we translate from en --> qqq, Cxserver will not do any translation but try to perform adaptation on the content. We should review if this is the behavior that we want.

Note that the actual HTTPError: 503: MW API error does not have anything to do with qqq being the target language. The HTTP 503 error is because of the requested API not being available.

Lets throw an error if the language code is invalid.

Change #1224083 had a related patch set uploaded (by Abijeet Patro; author: Abijeet Patro):

[mediawiki/services/cxserver@master] /translate/:from/:to/:provider?: Validate language pairs

https://gerrit.wikimedia.org/r/1224083

Change #1224084 had a related patch set uploaded (by Abijeet Patro; author: Abijeet Patro):

[mediawiki/services/cxserver@master] Validate language pairs when processing requests

https://gerrit.wikimedia.org/r/1224084

Change #1224083 abandoned by Abijeet Patro:

[mediawiki/services/cxserver@master] /translate/:from/:to/:provider?: Validate language pairs

Reason:

Not needed.

https://gerrit.wikimedia.org/r/1224083

Change #1224084 merged by jenkins-bot:

[mediawiki/services/cxserver@master] Validate language pairs when processing requests

https://gerrit.wikimedia.org/r/1224084

Change #1225807 had a related patch set uploaded (by KartikMistry; author: KartikMistry):

[operations/deployment-charts@master] Update cxserver to 2026-01-09-231405-production

https://gerrit.wikimedia.org/r/1225807

Change #1225807 merged by jenkins-bot:

[operations/deployment-charts@master] Update cxserver to 2026-01-09-231405-production

https://gerrit.wikimedia.org/r/1225807

abi_ changed the task status from Open to In Progress.Mon, Feb 2, 10:18 AM
abi_ moved this task from Pending Deployment to In Progress on the LPL Essential (FY2025-26 Q3) board.

I'm still seeing the associated error in Logstash because we have a TestClient that supports qqq language code. Need to see if this TestClient is still needed.

The TestClient was updated last 8 years ago in this commit: https://github.com/wikimedia/mediawiki-services-cxserver/commit/218a5439e5fc0043995850ec294db87c872f068e