apache/superset · error
Invalid language code
Error message
Invalid language code
What it means
Error "Invalid language code" thrown in apache/superset.
Source
Thrown at superset/views/core.py:695
"""
datasource_id, datasource_type = request.args["datasourceKey"].split("__")
datasource = DatasourceDAO.get_datasource(
DatasourceType(datasource_type), int(datasource_id)
)
# Check if datasource exists
if not datasource:
return json_error_response(DATASOURCE_MISSING_ERR)
datasource.raise_for_access()
return json_success(json.dumps(sanitize_datasource_data(datasource.data)))
@event_logger.log_this
@has_access
@expose("/language_pack/<lang>/")
def language_pack(self, lang: str) -> FlaskResponse:
# Only allow expected language formats like "en", "pt_BR", etc.
if not LANGUAGE_CODE_RE.match(lang):
abort(400, "Invalid language code")
base_dir = os.path.join(os.path.dirname(__file__), "..", "translations")
file_path = safe_join(base_dir, lang, "LC_MESSAGES", "messages.json")
if file_path and os.path.isfile(file_path):
return send_file(file_path, mimetype="application/json")
return json_error_response(
"Language pack doesn't exist on the server", status=404
)
@expose("/language_pack/<lang>/<version>/script.js")
def language_pack_script(self, lang: str, version: str) -> FlaskResponse:
"""Serve the language pack as a content-addressed classic script.
spa.html loads this BEFORE the entry bundle so translations are
configured synchronously (no race with code-split chunks), while the
versioned URL lets browsers cache the pack as immutable and pick up aView on GitHub (pinned to f4587218dd)
Solutions
- Use a supported language code (e.g., en, fr, zh) as defined in LANGUAGES.
When it happens
Trigger: A request carries an unrecognized language code.
Common situations: Posting a language pack whose language code is not a valid/known code.
AI-assisted analysis of apache/superset@f4587218dd (2026-08-14).
Data as JSON: /api/errors/8bf1f3cf6396e963.
Report an issue: GitHub.