infiniflow/ragflow · warning · RuntimeError
SSH execution output exceeded {self.max_output_bytes} bytes.
Error message
SSH execution output exceeded {self.max_output_bytes} bytes. What it means
Raised as RuntimeError by _validate_output_size after a command completes, when encoded stdout+stderr combined exceed self.max_output_bytes (default 1 MiB, configurable at initialize). It fires after execution succeeded — the process ran, output was captured, then rejected — so the run's output is lost when it raises. This guards the agent pipeline from multi-megabyte dumps entering structured-result extraction.
Source
Thrown at agent/sandbox/providers/ssh.py:607
if time.time() > deadline:
channel.close()
raise TimeoutError(f"Execution timed out after {timeout} seconds")
time.sleep(0.1)
while channel.recv_ready():
stdout_chunks.append(channel.recv(65536))
while channel.recv_stderr_ready():
stderr_chunks.append(channel.recv_stderr(65536))
exit_code = channel.recv_exit_status()
stdout = b"".join(stdout_chunks).decode("utf-8", errors="replace")
stderr = b"".join(stderr_chunks).decode("utf-8", errors="replace")
return stdout, stderr, exit_code
def _validate_output_size(self, stdout: str, stderr: str) -> None:
output_size = len((stdout or "").encode("utf-8")) + len((stderr or "").encode("utf-8"))
if output_size > self.max_output_bytes:
raise RuntimeError(f"SSH execution output exceeded {self.max_output_bytes} bytes.")
def _collect_artifacts(
self,
sftp: paramiko.SFTPClient,
artifacts_dir: str,
) -> list[dict[str, Any]]:
artifacts: list[dict[str, Any]] = []
self._collect_artifacts_recursive(sftp, artifacts_dir, "", artifacts)
return artifacts
def _collect_artifacts_recursive(
self,
sftp: paramiko.SFTPClient,
current_dir: str,
relative_dir: str,
artifacts: list[dict[str, Any]],
) -> None:
try:View on GitHub (pinned to 554fb1133a)
Solutions
- Reduce output in the sandboxed code: print head()/summaries, write bulk data to files instead of stdout
- Raise the limit at initialize: config {'max_output_bytes': 4*1024*1024} if the pipeline can absorb it
- Capture stderr separately in your code so warnings don't inflate combined size
Example fix
# before
provider.execute_code(inst, "print(open('big.csv').read())", "python")
# after
provider.execute_code(inst, "print(open('big.csv').read()[:2000])", "python") Defensive patterns
Strategy: validation
Validate before calling
estimated = len(stdout_text.encode()) + len(stderr_text.encode())
if estimated > provider.max_output_bytes:
raise RuntimeError("output will exceed provider limit; print a summary instead") Try / catch
try:
result = provider.execute_code(instance_id, code, language)
except RuntimeError as e:
if "exceeded" in str(e) and "bytes" in str(e):
code = code.replace("print(df)", "print(df.head())")
result = provider.execute_code(instance_id, code, language) Prevention
- Default sandboxed code to previews: head(), first N lines, truncated strings
- Size max_output_bytes deliberately at initialize based on what downstream LLM context can absorb
- Route bulk data to files/artifacts, not stdout
When it happens
Trigger: Code that prints large data (dumping a DataFrame, cat-ing a big file, verbose logs); combining stdout and stderr just over the limit; lowering max_output_bytes in config below typical output size; the structured-result marker plus large payload.
Common situations: LLM code agents printing entire datasets instead of summaries; debugging prints left in generated code; default 1 MiB too small for legitimate CSV previews.
Related errors
- SANDBOX_LOCAL_MAX_OUTPUT_BYTES must be greater than 0.
- Invalid SSH provider configuration.
- Execution timeout must be greater than 0 seconds, got {reque
- Unsupported language for SSH provider: {language}
- SANDBOX_LOCAL_TIMEOUT must be greater than 0.
AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15).
Data as JSON: /api/errors/be3e6b2136999a22.
Report an issue: GitHub.