badges/shields · error · InvalidResponse
Language not in project
Error message
Language not in project
What it means
The POEditor badge service throws this via InvalidResponse when the API returns HTTP 200 but the response payload does not include a `language` object. POEditor's API reports 'Language not in project' in its message field with a 200 status, so the service detects the missing language key and converts it into a structured InvalidResponse error. It means the requested language code is not defined for the given POEditor project.
Source
Thrown at services/poeditor/poeditor.service.js:74
queryParam({
name: 'token',
example: 'abc123def456',
description:
'A read-only token from your POEditor account from [My Account > API Access](https://poeditor.com/account/api)',
required: true,
}),
],
},
},
}
static render({ code, message, language }) {
if (code !== 200) {
throw new InvalidResponse({ prettyMessage: message })
}
if (language === undefined) {
throw new InvalidResponse({ prettyMessage: 'Language not in project' })
}
return {
label: language.name,
message: `${language.percentage.toFixed(0)}%`,
color: coveragePercentage(language.percentage),
}
}
async fetch({ projectId, token }) {
return this._requestJson({
schema,
url: 'https://api.poeditor.com/v2/languages/list',
options: {
method: 'POST',
form: {
api_token: token,
id: projectId,View on GitHub (pinned to 766fd8bc89)
Solutions
- Check the language code in your POEditor project settings (Languages tab) and use the exact code in the badge URL
- Verify the project id/api key in the badge URL points to the project that contains the language
- Add the missing language to the POEditor project if it should exist
Example fix
// before /badge/poeditor/12345/fr (project has no 'fr') // after /badge/poeditor/12345/fr-FR (code matches POEditor project language)
Defensive patterns
Strategy: try-catch
Validate before calling
// check the language exists in your POEditor project before rendering
const langs = await poeditorApi('languages', { api_token, id: projectId })
if (!langs.some(l => l.code === requestedCode)) throw new Error(`language ${requestedCode} not in project ${projectId}`) Type guard
function hasLanguage(resp) { return resp != null && resp.language !== undefined && typeof resp.language.percentage === 'number' } Try / catch
try {
const badge = await service.handle({ code, message, language: 'fr-FR' })
} catch (err) {
if (err.prettyMessage === 'Language not in project') {
// fall back to a neutral badge
renderBadge({ label: 'poeditor', message: 'n/a' })
} else throw err
} Prevention
- Always copy language codes directly from the POEditor project Languages tab
- Add an integration test per badge URL used in production
- Watch for language deletions in your POEditor project
When it happens
Trigger: Calling the POEditor badge with a language code that is not configured in the project (e.g. typo like 'en_US' vs 'en'), a language that was removed from the project, or querying the wrong project id.
Common situations: Projects renamed or deleted languages; users copy a badge URL from another project; POEditor language codes differ from locale codes (zh-CN vs zh); wrong api key pointing to a different project.
Related errors
- unparseable json response
- package not found
- No maintainer
- no images found for arch ${arch}
- Invalid flags, must be one of: ${VALID_FLAGS}
AI-assisted analysis of badges/shields@766fd8bc89 (2026-08-30).
Data as JSON: /api/errors/217d888cb7da38df.
Report an issue: GitHub.