{"record":{"id":"076658c7fd8114c0","repo":"infiniflow/ragflow","slug":"invalid-tenki-provider-configuration","errorCode":null,"errorMessage":"Invalid Tenki provider configuration.","messagePattern":"Invalid Tenki provider configuration\\.","errorType":"exception","errorClass":"SandboxProviderConfigError","httpStatus":null,"severity":"error","filePath":"agent/sandbox/providers/tenki.py","lineNumber":114,"sourceCode":"        self.cpu_cores = int(config.get(\"cpu_cores\", 0) or 0)\n        self.memory_mb = int(config.get(\"memory_mb\", 0) or 0)\n        self.disk_size_gb = int(config.get(\"disk_size_gb\", 0) or 0)\n        self.max_output_bytes = int(config.get(\"max_output_bytes\", 1024 * 1024) or 1024 * 1024)\n        self.max_artifacts = int(config.get(\"max_artifacts\", 20) or 20)\n        self.max_artifact_bytes = int(config.get(\"max_artifact_bytes\", 10 * 1024 * 1024) or 10 * 1024 * 1024)\n\n        is_valid, error_message = self.validate_config(\n            {\n                \"api_key\": self.api_key,\n                \"timeout\": self.timeout,\n                \"max_lifetime\": self.max_lifetime,\n                \"max_output_bytes\": self.max_output_bytes,\n                \"max_artifacts\": self.max_artifacts,\n                \"max_artifact_bytes\": self.max_artifact_bytes,\n            }\n        )\n        if not is_valid:\n            raise SandboxProviderConfigError(error_message or \"Invalid Tenki provider configuration.\")\n\n        self._client = self._create_client()\n        self._assert_connectivity()\n\n        self._initialized = True\n        logger.info(\"Tenki provider initialized\")\n        return True\n\n    def create_instance(self, template: str = \"python\") -> SandboxInstance:\n        if not self._initialized:\n            raise RuntimeError(\"Provider not initialized. Call initialize() first.\")\n\n        language = self._normalize_language(template)\n        errors = self._tenki_errors()\n\n        create_kwargs: dict[str, Any] = {\n            \"allow_outbound\": self.allow_outbound,\n            \"max_duration\": self.max_lifetime,","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/agent/sandbox/providers/tenki.py#L96-L132","documentation":"Raised by TenkiProvider.initialize() when validate_config() rejects the merged provider config. The config dict (api_key, timeout, max_lifetime, max_output_bytes, max_artifacts, max_artifact_bytes) failed one of the base provider's validation rules, so the provider refuses to start and stays uninitialized.","triggerScenarios":"Calling provider.initialize(config) with an empty or whitespace api_key, a timeout/max_lifetime of zero or negative, or non-positive byte/artifact caps (e.g. max_output_bytes=0). The fallback message 'Invalid Tenki provider configuration.' appears only when validate_config returns a falsy error_message.","commonSituations":"Sandbox config passed from agent settings with a missing TENKI api_key, copying config keys with wrong names (e.g. 'apikey' instead of 'api_key'), or passing string values like '-1' that int()-coerce into invalid numbers.","solutions":["Ensure config contains a non-empty api_key and positive integers for timeout, max_lifetime, max_output_bytes, max_artifacts, max_artifact_bytes.","Log the error_message returned by validate_config() before it is swallowed; the specific reason is in the raised exception's message when provided.","Check the key names exactly: api_key, base_url, image, allow_outbound, timeout, max_lifetime, cpu_cores, memory_mb, disk_size_gb, max_output_bytes, max_artifacts, max_artifact_bytes."],"exampleFix":"# before\nprovider.initialize({\"api_key\": \"\", \"timeout\": 30})\n\n# after\nprovider.initialize({\"api_key\": os.environ[\"TENKI_API_KEY\"], \"timeout\": 30, \"max_output_bytes\": 1048576})","handlingStrategy":"validation","validationCode":"def valid_tenki_config(cfg: dict) -> bool:\n    return (\n        bool(str(cfg.get(\"api_key\", \"\")).strip())\n        and int(cfg.get(\"timeout\", 30)) > 0\n        and int(cfg.get(\"max_lifetime\", 3600)) > 0\n        and int(cfg.get(\"max_output_bytes\", 1048576)) > 0\n        and int(cfg.get(\"max_artifacts\", 20)) > 0\n        and int(cfg.get(\"max_artifact_bytes\", 10485760)) > 0\n    )\n\nif not valid_tenki_config(config):\n    raise ValueError(\"tenki config invalid before initialize()\")","typeGuard":null,"tryCatchPattern":"try:\n    provider.initialize(config)\nexcept SandboxProviderConfigError as exc:\n    logger.error(\"tenki config rejected: %s\", exc)\n    raise SystemExit(1) from exc","preventionTips":["Source api_key from a secrets store/env var, never hardcode or leave blank defaults.","Validate config values with the same positive-integer rules before calling initialize().","Fail startup on SandboxProviderConfigError instead of continuing to create_instance()."],"tags":["config","validation","sandbox","tenki"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}