infiniflow/ragflow · error · RuntimeError
Failed to create sandbox workspace: {result.stderr_text or '
Error message
Failed to create sandbox workspace: {result.stderr_text or 'unknown error'} What it means
Raised after the sandbox is created but the bootstrap 'mkdir -p <work_dir>/artifacts' command inside it exits non-zero. The remote workspace under /home/tenki could not be created, so the sandbox is terminated via _safe_terminate() and the create_instance() call fails.
Source
Thrown at agent/sandbox/providers/tenki.py:165
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,
"remote_work_dir": remote_work_dir,
"language": language,
}
logger.info("Tenki sandbox created (instance=%s, session=%s)", instance_id, sandbox.id)
return SandboxInstance(
instance_id=instance_id,
provider="tenki",
status="running",
metadata={"language": language, "remote_work_dir": remote_work_dir, "sandbox_id": sandbox.id},
)View on GitHub (pinned to 554fb1133a)
Solutions
- Use the default image or ensure the custom image has a writable /home/tenki for user 'tenki'.
- Increase disk_size_gb if the message indicates ENOSPC; check result.stderr_text in the exception message for the exact mkdir error.
- Re-run create_instance() — transient microVM bootstrap failures are occasionally resolved by a fresh sandbox.
Example fix
# before
config = {"api_key": key, "image": "custom-no-tenki-user:1.0"}
# after
config = {"api_key": key} # default image with writable /home/tenki Defensive patterns
Strategy: try-catch
Try / catch
try:
instance = provider.create_instance(template)
except RuntimeError as exc:
if "Failed to create sandbox workspace" in str(exc):
# sandbox was already terminated by the provider; safe to retry once
instance = provider.create_instance(template)
else:
raise Prevention
- Use the default image or verify custom images have a writable /home/tenki for user 'tenki'.
- Set disk_size_gb comfortably above workspace needs (or leave 0 for default).
- Read the stderr_text embedded in the message — it carries mkdir's errno.
When it happens
Trigger: A custom image where /home/tenki is missing or not writable by the unprivileged 'tenki' user, a read-only or full filesystem in the microVM, or the mkdir being killed by the min(timeout, 10)s deadline returning a failure exit code.
Common situations: Swapping the default image for one with a different user/home layout; disk_size_gb set so small the filesystem cannot hold the workspace; custom images without a 'tenki' user account.
Related errors
- Unsupported artifact entry: {path.name}
- Invalid Tenki provider configuration.
- Provider not initialized. Call initialize() first.
- Tenki quota exceeded: {exc}
- Tenki rate limited, please retry: {exc}
AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15).
Data as JSON: /api/errors/6cd0fccefe369751.
Report an issue: GitHub.