{"record":{"id":"ef82fa7720a7effe","repo":"infiniflow/ragflow","slug":"unsupported-language-for-tenki-provider-language","errorCode":null,"errorMessage":"Unsupported language for Tenki provider: {language}","messagePattern":"Unsupported language for Tenki provider: (.+?)","errorType":"validation","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"agent/sandbox/providers/tenki.py","lineNumber":428,"sourceCode":"        errors = self._tenki_errors()\n        try:\n            client.who_am_i()\n        except errors.UnauthorizedError as exc:\n            raise SandboxProviderConfigError(\"Tenki authentication failed: check the API key.\") from exc\n        except Exception as exc:\n            raise SandboxProviderConfigError(f\"Failed to reach Tenki API: {exc}\") from exc\n\n    def _prepare_script(self, sandbox, remote_work_dir: str, language: str, code: str, args_json: str) -> tuple[str, list[str]]:\n        if language == \"python\":\n            script_name = \"main.py\"\n            script_content = build_python_wrapper(code, args_json)\n            executable = \"python3\"\n        elif language in {\"javascript\", \"nodejs\"}:\n            script_name = \"main.js\"\n            script_content = build_javascript_wrapper(code, args_json)\n            executable = \"node\"\n        else:\n            raise RuntimeError(f\"Unsupported language for Tenki provider: {language}\")\n\n        script_path = posixpath.join(remote_work_dir, script_name)\n        sandbox.fs.write_text(script_path, script_content)\n        return script_path, [executable, script_path]\n\n    def _validate_output_size(self, stdout: str, stderr: str) -> None:\n        output_size = len((stdout or \"\").encode(\"utf-8\")) + len((stderr or \"\").encode(\"utf-8\"))\n        if output_size > self.max_output_bytes:\n            raise RuntimeError(f\"Tenki execution output exceeded {self.max_output_bytes} bytes.\")\n\n    def _collect_artifacts(self, sandbox, artifacts_dir: str) -> list[dict[str, Any]]:\n        artifacts: list[dict[str, Any]] = []\n        self._collect_artifacts_recursive(sandbox, artifacts_dir, \"\", artifacts, depth=0)\n        return artifacts\n\n    def _collect_artifacts_recursive(self, sandbox, current_dir: str, relative_dir: str, artifacts: list[dict[str, Any]], depth: int) -> None:\n        if depth > MAX_ARTIFACT_DEPTH:\n            raise RuntimeError(f\"Artifact directory nesting exceeds {MAX_ARTIFACT_DEPTH} levels: {relative_dir}\")","sourceCodeStart":410,"sourceCodeEnd":446,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/agent/sandbox/providers/tenki.py#L410-L446","documentation":"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.","triggerScenarios":"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.","commonSituations":"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').","solutions":["Use 'python' or 'javascript' (alias 'nodejs') as template/language.","Map unsupported languages upstream: rewrite the generated code to Python/JS instead of passing it through.","Check _normalize_language's accepted aliases before introducing new template names in agent configs."],"exampleFix":"# before\ninstance = provider.create_instance(template=\"java\")\n\n# after\ninstance = provider.create_instance(template=\"python\")  # or \"javascript\"","handlingStrategy":"type-guard","validationCode":"SUPPORTED = {\"python\", \"javascript\", \"nodejs\"}\ntemplate = _normalize(template)  # your alias map\nif template not in SUPPORTED:\n    raise ValueError(f\"unsupported template {template!r}; use {SUPPORTED}\")","typeGuard":"def is_supported_language(lang: str) -> bool:\n    return str(lang).strip().lower() in {\"python\", \"javascript\", \"nodejs\"}","tryCatchPattern":null,"preventionTips":["Whitelist template/language values at the agent/tool boundary before they reach the provider.","Constrain LLM code-generation prompts to python/javascript only.","Map template aliases ('js' -> 'javascript', 'py' -> 'python') centrally."],"tags":["language","validation","sandbox","tenki"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}