{"record":{"id":"8bf1f3cf6396e963","repo":"apache/superset","slug":"invalid-language-code","errorCode":null,"errorMessage":"Invalid language code","messagePattern":"Invalid language code","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"superset/views/core.py","lineNumber":695,"sourceCode":"        \"\"\"\n        datasource_id, datasource_type = request.args[\"datasourceKey\"].split(\"__\")\n        datasource = DatasourceDAO.get_datasource(\n            DatasourceType(datasource_type), int(datasource_id)\n        )\n        # Check if datasource exists\n        if not datasource:\n            return json_error_response(DATASOURCE_MISSING_ERR)\n\n        datasource.raise_for_access()\n        return json_success(json.dumps(sanitize_datasource_data(datasource.data)))\n\n    @event_logger.log_this\n    @has_access\n    @expose(\"/language_pack/<lang>/\")\n    def language_pack(self, lang: str) -> FlaskResponse:\n        # Only allow expected language formats like \"en\", \"pt_BR\", etc.\n        if not LANGUAGE_CODE_RE.match(lang):\n            abort(400, \"Invalid language code\")\n\n        base_dir = os.path.join(os.path.dirname(__file__), \"..\", \"translations\")\n        file_path = safe_join(base_dir, lang, \"LC_MESSAGES\", \"messages.json\")\n\n        if file_path and os.path.isfile(file_path):\n            return send_file(file_path, mimetype=\"application/json\")\n\n        return json_error_response(\n            \"Language pack doesn't exist on the server\", status=404\n        )\n\n    @expose(\"/language_pack/<lang>/<version>/script.js\")\n    def language_pack_script(self, lang: str, version: str) -> FlaskResponse:\n        \"\"\"Serve the language pack as a content-addressed classic script.\n\n        spa.html loads this BEFORE the entry bundle so translations are\n        configured synchronously (no race with code-split chunks), while the\n        versioned URL lets browsers cache the pack as immutable and pick up a","sourceCodeStart":677,"sourceCodeEnd":713,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/views/core.py#L677-L713","documentation":"Error \"Invalid language code\" thrown in apache/superset.","triggerScenarios":"A request carries an unrecognized language code.","commonSituations":"Posting a language pack whose language code is not a valid/known code.","solutions":["Use a supported language code (e.g., en, fr, zh) as defined in LANGUAGES."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}