infiniflow/ragflow · error · RuntimeError
Failed to create Tenki sandbox: {exc}
Error message
Failed to create Tenki sandbox: {exc} What it means
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'.
Source
Thrown at agent/sandbox/providers/tenki.py:154
create_kwargs["image"] = self.image
if self.cpu_cores > 0:
create_kwargs["cpu_cores"] = self.cpu_cores
if self.memory_mb > 0:
create_kwargs["memory_mb"] = self.memory_mb
if self.disk_size_gb > 0:
create_kwargs["disk_size_gb"] = self.disk_size_gb
try:
sandbox = self._client.create(**create_kwargs)
except errors.QuotaExceededError as exc:
raise RuntimeError(f"Tenki quota exceeded: {exc}") from exc
except errors.RateLimitedError as exc:
raise RuntimeError(f"Tenki rate limited, please retry: {exc}") from exc
except errors.UnauthorizedError as exc:
raise SandboxProviderConfigError("Tenki authentication failed: check the API key.") from exc
except Exception as exc:
# Satisfy the base contract: any other SDK failure becomes RuntimeError.
raise RuntimeError(f"Failed to create Tenki sandbox: {exc}") from exc
remote_work_dir = posixpath.join(SANDBOX_HOME, f"ragflow-codeexec-{uuid.uuid4().hex}")
try:
result = sandbox.exec(
"mkdir",
"-p",
posixpath.join(remote_work_dir, "artifacts"),
timeout=min(self.timeout, 10),
)
if result.exit_code != 0:
raise RuntimeError(f"Failed to create sandbox workspace: {result.stderr_text or 'unknown error'}")
except Exception:
self._safe_terminate(sandbox)
raise
instance_id = str(uuid.uuid4())
self._instances[instance_id] = {
"sandbox": sandbox,View on GitHub (pinned to 554fb1133a)
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.
Example fix
# before
config = {"api_key": key, "image": "my-image:latest-typo"}
# after
config = {"api_key": key, "image": "tenki/python:3.12"} # verified existing image; or omit image entirely for default Defensive patterns
Strategy: try-catch
Validate before calling
# validate image/resources against account limits before create
if config.get("image") and not image_exists_in_registry(config["image"]):
raise ValueError(f"unknown image {config['image']}")
for k in ("cpu_cores", "memory_mb", "disk_size_gb"):
if config.get(k, 0) < 0:
raise ValueError(f"{k} must be >= 0") Try / catch
try:
instance = provider.create_instance(template)
except RuntimeError as exc:
logger.error("tenki create failed, cause=%r", exc.__cause__)
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Invalid Tenki provider configuration.
- Provider not initialized. Call initialize() first.
- Tenki quota exceeded: {exc}
- Tenki rate limited, please retry: {exc}
- Failed to create sandbox workspace: {result.stderr_text or '
AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15).
Data as JSON: /api/errors/09c789c486163901.
Report an issue: GitHub.