infiniflow/ragflow · error · RuntimeError

Unsupported language for Tenki provider: {language}

Error message

Unsupported language for Tenki provider: {language}

What it means

Raised by _prepare_script() when the normalized language is not 'python' or 'javascript'/'nodejs'. The Tenki provider only knows how to build wrappers and pick an interpreter (python3 / node) for those two languages; anything else has no script template.

Source

Thrown at agent/sandbox/providers/tenki.py:428

        errors = self._tenki_errors()
        try:
            client.who_am_i()
        except errors.UnauthorizedError as exc:
            raise SandboxProviderConfigError("Tenki authentication failed: check the API key.") from exc
        except Exception as exc:
            raise SandboxProviderConfigError(f"Failed to reach Tenki API: {exc}") from exc

    def _prepare_script(self, sandbox, remote_work_dir: str, language: str, code: str, args_json: str) -> tuple[str, list[str]]:
        if language == "python":
            script_name = "main.py"
            script_content = build_python_wrapper(code, args_json)
            executable = "python3"
        elif language in {"javascript", "nodejs"}:
            script_name = "main.js"
            script_content = build_javascript_wrapper(code, args_json)
            executable = "node"
        else:
            raise RuntimeError(f"Unsupported language for Tenki provider: {language}")

        script_path = posixpath.join(remote_work_dir, script_name)
        sandbox.fs.write_text(script_path, script_content)
        return script_path, [executable, script_path]

    def _validate_output_size(self, stdout: str, stderr: str) -> None:
        output_size = len((stdout or "").encode("utf-8")) + len((stderr or "").encode("utf-8"))
        if output_size > self.max_output_bytes:
            raise RuntimeError(f"Tenki execution output exceeded {self.max_output_bytes} bytes.")

    def _collect_artifacts(self, sandbox, artifacts_dir: str) -> list[dict[str, Any]]:
        artifacts: list[dict[str, Any]] = []
        self._collect_artifacts_recursive(sandbox, artifacts_dir, "", artifacts, depth=0)
        return artifacts

    def _collect_artifacts_recursive(self, sandbox, current_dir: str, relative_dir: str, artifacts: list[dict[str, Any]], depth: int) -> None:
        if depth > MAX_ARTIFACT_DEPTH:
            raise RuntimeError(f"Artifact directory nesting exceeds {MAX_ARTIFACT_DEPTH} levels: {relative_dir}")

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Use 'python' or 'javascript' (alias 'nodejs') as template/language.
  2. Map unsupported languages upstream: rewrite the generated code to Python/JS instead of passing it through.
  3. Check _normalize_language's accepted aliases before introducing new template names in agent configs.

Example fix

# before
instance = provider.create_instance(template="java")

# after
instance = provider.create_instance(template="python")  # or "javascript"
Defensive patterns

Strategy: type-guard

Validate before calling

SUPPORTED = {"python", "javascript", "nodejs"}
template = _normalize(template)  # your alias map
if template not in SUPPORTED:
    raise ValueError(f"unsupported template {template!r}; use {SUPPORTED}")

Type guard

def is_supported_language(lang: str) -> bool:
    return str(lang).strip().lower() in {"python", "javascript", "nodejs"}

Prevention

When it happens

Trigger: create_instance(template=...) or execute_code(..., language=...) with values like 'java', 'go', 'bash', or a typo ('pythn'). _normalize_language lowercases/aliases but cannot invent support, so the else branch fires.

Common situations: Passing a general-purpose LLM's language choice straight through, porting code from another provider that supported more languages, or template names that don't map ('python3.12' vs 'python').

Related errors


AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15). Data as JSON: /api/errors/ef82fa7720a7effe. Report an issue: GitHub.