{"record":{"id":"4aaf59d0cc4282db","repo":"srbhr/Resume-Matcher","slug":"unsupported-content-language-request-content-lan","errorCode":null,"errorMessage":"Unsupported content language: {request.content_language}. Supported: {SUPPORTED_LANGUAGES}","messagePattern":"Unsupported content language: (.+?)\\. Supported: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"warning","filePath":"apps/backend/app/routers/config.py","lineNumber":330,"sourceCode":"async def update_language_config(\n    request: LanguageConfigRequest,\n) -> LanguageConfigResponse:\n    \"\"\"Update language configuration.\"\"\"\n    stored = _load_config()\n\n    # Validate and update UI language\n    if request.ui_language is not None:\n        if request.ui_language not in SUPPORTED_LANGUAGES:\n            raise HTTPException(\n                status_code=400,\n                detail=f\"Unsupported UI language: {request.ui_language}. Supported: {SUPPORTED_LANGUAGES}\",\n            )\n        stored[\"ui_language\"] = request.ui_language\n\n    # Validate and update content language\n    if request.content_language is not None:\n        if request.content_language not in SUPPORTED_LANGUAGES:\n            raise HTTPException(\n                status_code=400,\n                detail=f\"Unsupported content language: {request.content_language}. Supported: {SUPPORTED_LANGUAGES}\",\n            )\n        stored[\"content_language\"] = request.content_language\n\n    # Save config\n    _save_config(stored)\n\n    # Support legacy single 'language' field migration\n    legacy_language = stored.get(\"language\", \"en\")\n\n    return LanguageConfigResponse(\n        ui_language=stored.get(\"ui_language\", legacy_language),\n        content_language=stored.get(\"content_language\", legacy_language),\n        supported_languages=SUPPORTED_LANGUAGES,\n    )\n\n","sourceCodeStart":312,"sourceCodeEnd":348,"githubUrl":"https://github.com/srbhr/Resume-Matcher/blob/116f9cc3b00e1ac91734a6c2679bf41ea64a0edc/apps/backend/app/routers/config.py#L312-L348","documentation":"A 400 HTTPException raised by update_language_config when request.content_language is provided but not in SUPPORTED_LANGUAGES. Same whitelist mechanism as the ui_language check, applied to the content language that governs generated cover letters/outreach content.","triggerScenarios":"PUT/POST language config with content_language not in SUPPORTED_LANGUAGES, e.g. 'de-DE' when only 'de' is supported, or a language the backend cannot generate content in.","commonSituations":"Client offers more language options than the backend supports; user selects a language from an OS locale that isn't whitelisted; config synced from another deployment with a different SUPPORTED_LANGUAGES set.","solutions":["Send a content_language exactly matching a value in SUPPORTED_LANGUAGES","Fetch the supported list from the backend options endpoint and restrict the UI picker to it","Omit content_language from the request to leave it unchanged"],"exampleFix":"// before\nawait api.updateLanguageConfig({ content_language: 'de-DE' })\n// after\nawait api.updateLanguageConfig({ content_language: 'de' })","handlingStrategy":"validation","validationCode":"const SUPPORTED = await api.getSupportedLanguages()\nif (contentLang && !SUPPORTED.includes(contentLang)) {\n  throw new Error(`content_language ${contentLang} not in ${SUPPORTED}`)\n}","typeGuard":null,"tryCatchPattern":"try {\n  await api.updateLanguageConfig({ content_language: lang })\n} catch (e) {\n  if (e.response?.status === 400 && String(e.response.data.detail).startsWith('Unsupported content language')) {\n    showToast(`Content language ${lang} is not supported`)\n  } else throw e\n}","preventionTips":["Restrict the content-language UI to values returned by the backend options endpoint","Map unsupported locales to nearest supported language","Omit content_language when unchanged","Keep frontend and backend language lists in sync via a shared source"],"tags":["validation","http-400","i18n","language"],"backgroundTag":"unsupported-language-code","analyzedSha":"116f9cc3b00e1ac91734a6c2679bf41ea64a0edc","analyzedAt":"2026-08-28T22:51:40.999Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}