infiniflow/ragflow · error · RuntimeError
Unsupported language for local provider: {language}
Error message
Unsupported language for local provider: {language} What it means
Raised by LocalProvider._prepare_script() when the normalized language is neither 'python' nor in {'javascript', 'nodejs'}. The provider only knows how to build a wrapper script for those languages (build_python_wrapper / build_javascript_wrapper), so any other language string reaches the trailing RuntimeError. Note _normalize_language() runs first, so only genuinely unsupported languages get here.
Source
Thrown at agent/sandbox/providers/local.py:279
if self.max_memory_mb <= 0:
raise SandboxProviderConfigError("SANDBOX_LOCAL_MAX_MEMORY_MB must be greater than 0.")
if self.max_output_bytes <= 0:
raise SandboxProviderConfigError("SANDBOX_LOCAL_MAX_OUTPUT_BYTES must be greater than 0.")
if self.max_artifacts < 0:
raise SandboxProviderConfigError("SANDBOX_LOCAL_MAX_ARTIFACTS must be greater than or equal to 0.")
if self.max_artifact_bytes <= 0:
raise SandboxProviderConfigError("SANDBOX_LOCAL_MAX_ARTIFACT_BYTES must be greater than 0.")
def _prepare_script(self, instance_dir: Path, language: str, code: str, args_json: str) -> tuple[list[str], Path]:
if language == "python":
script_path = instance_dir / "main.py"
script_path.write_text(build_python_wrapper(code, args_json), encoding="utf-8")
return [self.python_bin, str(script_path)], script_path
if language in {"javascript", "nodejs"}:
script_path = instance_dir / "main.js"
script_path.write_text(build_javascript_wrapper(code, args_json), encoding="utf-8")
return [self.node_bin, str(script_path)], script_path
raise RuntimeError(f"Unsupported language for local provider: {language}")
def _build_child_env(self, instance_dir: Path) -> dict[str, str]:
env = {
"HOME": str(instance_dir),
"MPLBACKEND": "Agg",
"PATH": os.environ.get("PATH", ""),
"PYTHONUNBUFFERED": "1",
"TMPDIR": str(instance_dir),
}
for name in LOCAL_PYTHON_THREAD_ENV_VARS:
value = os.environ.get(name)
if value is not None:
env[name] = value
return env
def _limit_child_process(self) -> None:
import resource
View on GitHub (pinned to 554fb1133a)
Solutions
- Pass one of the supported languages exactly: 'python', 'javascript', or 'nodejs'.
- Before executing, check language in provider.get_supported_languages() and reject/fallback in the caller for anything else.
- If you need another runtime, use a different provider (self_managed / SSH) or extend the provider with a new wrapper — do not retry with the same string.
- Print get_supported_languages() at startup in integrations to catch mismatches early.
Example fix
// before
result = provider.execute_code(instance_id, code, language="bash")
// after
supported = provider.get_supported_languages()
if language not in supported:
raise ValueError(f"Unsupported language {language!r}; supported: {supported}")
result = provider.execute_code(instance_id, code, language="python") Defensive patterns
Strategy: type-guard
Validate before calling
language = provider._normalize_language(language)
if language not in provider.get_supported_languages():
raise ValueError(f"Unsupported language: {language}") Type guard
from typing import Final
SUPPORTED: Final[frozenset[str]] = frozenset({"python", "javascript", "nodejs"})
def is_supported_language(lang: str) -> bool:
"""True when LocalProvider can execute this language."""
return isinstance(lang, str) and lang.strip().lower() in SUPPORTED Try / catch
try:
provider.execute_code(instance_id, code, language)
except RuntimeError as e:
if "Unsupported language" in str(e):
# re-dispatch as python or reject the request
raise ValueError(str(e)) from e
raise Prevention
- Whitelist languages from get_supported_languages() at the API/tool boundary before reaching the provider.
- For LLM-driven calls, constrain the language parameter in the tool schema (enum).
When it happens
Trigger: Calling execute_code(instance_id, code, language='bash'|'go'|'java'|'ruby'|''); passing a template string to create_instance() that normalizes to something outside the supported set. Check get_supported_languages() — it returns ['python', 'javascript', 'nodejs'].
Common situations: An LLM-generated agent tool call specifying an unsupported language; version skew where a caller assumes a language added in a newer release; typos like 'js' if _normalize_language does not map them; passing a template name (e.g. 'python:3.11') instead of a bare language.
Related errors
- No sandbox provider configured. Please configure sandbox set
- SANDBOX_LOCAL_TIMEOUT must be greater than 0.
- SANDBOX_LOCAL_MAX_MEMORY_MB must be greater than 0.
- SANDBOX_LOCAL_MAX_OUTPUT_BYTES must be greater than 0.
- SANDBOX_LOCAL_MAX_ARTIFACTS must be greater than or equal to
AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15).
Data as JSON: /api/errors/9e2b454e278fddfa.
Report an issue: GitHub.