badges/shields · error · InvalidResponse
Unsupported language
Error message
Unsupported language
What it means
The Localizely service fetches project statistics containing a per-language breakdown. When transforming the response, it looks up the requested language code in json.languages; if no language object matches the requested langCode, it throws InvalidResponse('Unsupported language') because the upstream API returned no data for that language.
Source
Thrown at services/localizely/localizely.service.js:137
url: `https://api.localizely.com/v1/projects/${projectId}/status`,
options: {
searchParams: { branch },
headers: { 'X-Api-Token': apiToken },
},
httpErrors: {
403: 'not authorized for project',
},
})
}
static transform(json, languageCode) {
if (!languageCode) {
return { reviewedProgress: json.reviewedProgress }
}
const language = json.languages.find(lang => lang.langCode === languageCode)
if (!language) {
throw new InvalidResponse({ prettyMessage: 'Unsupported language' })
}
const { langName, reviewedProgress } = language
return { langName, reviewedProgress }
}
async handle({ projectId, branch }, { token: apiToken, languageCode }) {
const json = await this.fetch({ projectId, branch, apiToken })
const { langName, reviewedProgress } = this.constructor.transform(
json,
languageCode,
)
return this.constructor.render({ langName, reviewedProgress })
}
}
View on GitHub (pinned to 766fd8bc89)
Solutions
- Check the language code in the badge URL against the languages actually configured in your Localizely project.
- Use the exact langCode casing/format Localizely reports (e.g. 'en-US').
- Add the missing language to the Localizely project if you need a badge for it.
Example fix
// before /localizely/reviewed-progress/myproject/EN.svg // after /localizely/reviewed-progress/myproject/en-US.svg
Defensive patterns
Strategy: validation
Validate before calling
const knownLangs = ['en-US','de-DE','fr-FR'] // from Localizely project settings
if (!knownLangs.includes(languageCode)) throw new Error(`Language ${languageCode} not configured in Localizely project`) Type guard
const isSupportedLanguage = (json, code) => typeof code === 'string' && Array.isArray(json?.languages) && json.languages.some(l => l.langCode === code)
Try / catch
try {
return await service.transform(json, languageCode)
} catch (e) {
if (e instanceof InvalidResponse && e.prettyMessage === 'Unsupported language') {
// fall back to overall reviewedProgress or surface a config error to the user
}
throw e
} Prevention
- Copy language codes directly from your Localizely project settings.
- Use exact langCode format (BCP-47, e.g. 'pt-BR') as reported by the API.
- Validate badge URLs against the project's language list at build time.
When it happens
Trigger: Requesting a badge for a language code that does not exist in the Localizely project's language list, so json.languages.find(lang => lang.langCode === languageCode) returns undefined.
Common situations: Typos or wrong casing in the language code (e.g. 'EN' vs 'en'), the language having been deleted from the Localizely project, or requesting a language never configured in the project.
Related errors
- invalid response data from auth endpoint
- unparseable svg response
- unparseable toml response
- unparseable xml response
- unparseable yaml response
AI-assisted analysis of badges/shields@766fd8bc89 (2026-08-30).
Data as JSON: /api/errors/d8c455c8d96379b0.
Report an issue: GitHub.