infiniflow/ragflow · error · RuntimeError
{stderr.decode()}
Error message
{stderr.decode()} What it means
Raised when streaming a tarball into the container via `docker exec -i <container> tar xzf - -C /workspace/<task_id>` fails (non-zero returncode). The raw stderr bytes from the docker/tar pipeline are decoded directly into the message. Note the upstream host-side `tar czf` returncode is never checked, so a host tar failure surfaces here as a confusing container-side error.
Source
Thrown at agent/sandbox/executor_manager/services/execution.py:242
args_path = os.path.join(workdir, str(bundle["args_name"]))
with open(args_path, "w", encoding="utf-8") as f:
f.write(str(bundle["args_source"]))
returncode, _, stderr = await async_run_command("docker", "exec", container, "mkdir", "-p", f"/workspace/{task_id}", timeout=5)
if returncode != 0:
raise RuntimeError(f"Directory creation failed: {stderr}")
tar_proc = await asyncio.create_subprocess_exec("tar", "czf", "-", "-C", workdir, code_name, runner_name, str(bundle["args_name"]), stdout=asyncio.subprocess.PIPE)
tar_stdout, _ = await tar_proc.communicate()
docker_proc = await asyncio.create_subprocess_exec(
"docker", "exec", "-i", container, "tar", "xzf", "-", "-C", f"/workspace/{task_id}", stdin=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
)
stdout, stderr = await docker_proc.communicate(input=tar_stdout)
if docker_proc.returncode != 0:
raise RuntimeError(stderr.decode())
start_time = time.time()
try:
arguments = req.arguments or {}
logger.info("Passed in args keys=%s size_bytes=%s", list(arguments.keys()), len(json.dumps(arguments, ensure_ascii=False).encode("utf-8")))
run_args = _build_container_run_args(language=language, task_id=task_id, container=container, runner_name=runner_name)
returncode, stdout, stderr = await async_run_command(
*run_args,
timeout=TIMEOUT + 5,
)
time_used_ms = (time.time() - start_time) * 1000
logger.info("----------------------------------------------")
logger.info(f"Code: {str(base64.b64decode(req.code_b64))}")
logger.info(f"{returncode=}")
logger.info(f"{stdout=}")View on GitHub (pinned to 554fb1133a)
Solutions
- Read the decoded stderr: 'tar: not found' means the container image lacks tar — install it or use an image that has it.
- Check the host-side tar exit: tar_proc.returncode is currently ignored; log and check it before feeding tar_stdout to docker.
- Confirm the container is still running right before extraction (docker inspect).
- Check container disk space (`docker exec <c> df -h /workspace`) if stderr mentions 'No space left on device'.
Example fix
# before
tar_proc = await asyncio.create_subprocess_exec("tar", "czf", "-", "-C", workdir, code_name, runner_name, str(bundle["args_name"]), stdout=asyncio.subprocess.PIPE)
tar_stdout, _ = await tar_proc.communicate()
# after: fail fast on host tar errors so the container-side message is trustworthy
tar_stdout, tar_err = await tar_proc.communicate()
if tar_proc.returncode != 0:
raise RuntimeError(f"Host tar failed ({tar_proc.returncode}): {tar_err.decode()}") Defensive patterns
Strategy: validation
Validate before calling
# Ensure tar exists inside the container before streaming the bundle
returncode, _, _ = await async_run_command("docker", "exec", container, "sh", "-c", "command -v tar", timeout=5)
if returncode != 0:
raise RuntimeError(f"Container {container} has no tar; cannot stage code") Try / catch
try:
await stage_and_extract(...)
except RuntimeError as e:
stderr = str(e)
if "tar:" in stderr or "No space left" in stderr:
logger.error("Staging failed in container: %s", stderr)
raise Prevention
- Bake tar into the sandbox image.
- Check host-side tar returncode before piping into docker exec.
- Alert on container disk usage; extraction fails when the writable layer is full.
- Keep the host workdir alive until staging completes.
When it happens
Trigger: Executing staged code when: the target container does not have `tar` installed, the host `tar` failed (bad workdir/file names) producing an empty or corrupt stream, the container exited between the mkdir and extract steps, or disk is full inside the container.
Common situations: Alpine/minimal images without tar; host working directory deleted by a concurrent cleanup task; container OOM-killed mid-staging; filename with characters the host tar rejects; disk pressure in the container's writable layer.
Related errors
- Directory creation failed: {stderr}
- Command timed out
- Failed to initialize sandbox provider: {provider_type}. Conf
- No sandbox provider configured. Please configure sandbox set
- Invalid base64 encoding: {str(e)}
AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15).
Data as JSON: /api/errors/662c9997422e0b2e.
Report an issue: GitHub.