{"record":{"id":"09c789c486163901","repo":"infiniflow/ragflow","slug":"failed-to-create-tenki-sandbox-exc","errorCode":null,"errorMessage":"Failed to create Tenki sandbox: {exc}","messagePattern":"Failed to create Tenki sandbox: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"agent/sandbox/providers/tenki.py","lineNumber":154,"sourceCode":"            create_kwargs[\"image\"] = self.image\n        if self.cpu_cores > 0:\n            create_kwargs[\"cpu_cores\"] = self.cpu_cores\n        if self.memory_mb > 0:\n            create_kwargs[\"memory_mb\"] = self.memory_mb\n        if self.disk_size_gb > 0:\n            create_kwargs[\"disk_size_gb\"] = self.disk_size_gb\n\n        try:\n            sandbox = self._client.create(**create_kwargs)\n        except errors.QuotaExceededError as exc:\n            raise RuntimeError(f\"Tenki quota exceeded: {exc}\") from exc\n        except errors.RateLimitedError as exc:\n            raise RuntimeError(f\"Tenki rate limited, please retry: {exc}\") from exc\n        except errors.UnauthorizedError as exc:\n            raise SandboxProviderConfigError(\"Tenki authentication failed: check the API key.\") from exc\n        except Exception as exc:\n            # Satisfy the base contract: any other SDK failure becomes RuntimeError.\n            raise RuntimeError(f\"Failed to create Tenki sandbox: {exc}\") from exc\n\n        remote_work_dir = posixpath.join(SANDBOX_HOME, f\"ragflow-codeexec-{uuid.uuid4().hex}\")\n        try:\n            result = sandbox.exec(\n                \"mkdir\",\n                \"-p\",\n                posixpath.join(remote_work_dir, \"artifacts\"),\n                timeout=min(self.timeout, 10),\n            )\n            if result.exit_code != 0:\n                raise RuntimeError(f\"Failed to create sandbox workspace: {result.stderr_text or 'unknown error'}\")\n        except Exception:\n            self._safe_terminate(sandbox)\n            raise\n\n        instance_id = str(uuid.uuid4())\n        self._instances[instance_id] = {\n            \"sandbox\": sandbox,","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/agent/sandbox/providers/tenki.py#L136-L172","documentation":"Catch-all RuntimeError raised when client.create() fails with any exception other than QuotaExceededError, RateLimitedError, or UnauthorizedError. The base provider contract requires SDK failures to surface as RuntimeError, and the original exception is chained via 'from exc'.","triggerScenarios":"Tenki SDK errors such as invalid image name, requested cpu_cores/memory_mb/disk_size_gb larger than the account allows, malformed base_url, or transport-level failures during sandbox provisioning.","commonSituations":"Setting image to a tag that does not exist in the Tenki registry, over-specifying resources (create_kwargs only includes cpu_cores/memory_mb/disk_size_gb when > 0), or a base_url pointing at a non-API endpoint.","solutions":["Inspect the chained cause (exc.__cause__) — the original SDK exception names the real problem (image, resources, transport).","Validate image name and resource sizes against what the Tenki account/plan supports; set cpu_cores/memory_mb/disk_size_gb to 0 to use defaults.","If the message mentions connectivity, check base_url and network egress before retrying."],"exampleFix":"# before\nconfig = {\"api_key\": key, \"image\": \"my-image:latest-typo\"}\n\n# after\nconfig = {\"api_key\": key, \"image\": \"tenki/python:3.12\"}  # verified existing image; or omit image entirely for default","handlingStrategy":"try-catch","validationCode":"# validate image/resources against account limits before create\nif config.get(\"image\") and not image_exists_in_registry(config[\"image\"]):\n    raise ValueError(f\"unknown image {config['image']}\")\nfor k in (\"cpu_cores\", \"memory_mb\", \"disk_size_gb\"):\n    if config.get(k, 0) < 0:\n        raise ValueError(f\"{k} must be >= 0\")","typeGuard":null,"tryCatchPattern":"try:\n    instance = provider.create_instance(template)\nexcept RuntimeError as exc:\n    logger.error(\"tenki create failed, cause=%r\", exc.__cause__)\n    raise","preventionTips":["Inspect __cause__ first; the SDK's original error pinpoints image/resource/transport issues.","Leave cpu_cores/memory_mb/disk_size_gb at 0 unless the account supports the requested sizes.","Smoke-test new image names with one create_instance() before wiring them into production config."],"tags":["sandbox","sdk","create","tenki"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}