infiniflow/ragflow · error · RuntimeError
HTTP {response.status_code}: {response.text}
Error message
HTTP {response.status_code}: {response.text} What it means
Raised by SelfManagedProvider.execute_code() when the POST to {endpoint}/run returns any non-200 HTTP status. The full response body (response.text) is embedded in the RuntimeError, so the message carries the remote sandbox service's error detail — e.g. 400 bad payload, 413 code too large, 500 executor crash, 502/503 from a proxy in front of the sandbox service.
Source
Thrown at agent/sandbox/providers/self_managed.py:153
# Normalize language
normalized_lang = self._normalize_language(language)
# Prepare request
code_b64 = base64.b64encode(code.encode("utf-8")).decode("utf-8")
payload = {"code_b64": code_b64, "language": normalized_lang, "arguments": arguments or {}}
url = f"{self.endpoint}/run"
exec_timeout = timeout or self.timeout
start_time = time.time()
try:
response = requests.post(url, json=payload, timeout=exec_timeout, headers={"Content-Type": "application/json"})
execution_time = time.time() - start_time
if response.status_code != 200:
raise RuntimeError(f"HTTP {response.status_code}: {response.text}")
result = response.json()
structured_result = result.get("result") or {}
return ExecutionResult(
stdout=result.get("stdout", ""),
stderr=result.get("stderr", ""),
exit_code=result.get("exit_code", 0),
execution_time=execution_time,
metadata={
"status": result.get("status"),
"time_used_ms": result.get("time_used_ms"),
"memory_used_kb": result.get("memory_used_kb"),
"detail": result.get("detail"),
"instance_id": instance_id,
"artifacts": result.get("artifacts", []),
"result_present": structured_result.get("present", False),
"result_value": structured_result.get("value"),View on GitHub (pinned to 554fb1133a)
Solutions
- Read the embedded response body in the exception message — it is the remote service's own error and usually names the real cause.
- Verify the endpoint config points at the sandbox service's /run route (not a UI or proxy path) and the service is up (curl the health endpoint).
- For 413, shrink the code payload or raise the proxy body-size limit; for 401/403 fix credentials/auth config.
- Retry once on transient 502/503/504 (service restart), but fix persistent 4xx/5xx rather than retrying.
Example fix
# before
result = provider.execute_code(instance_id, code, "python") # raises HTTP 500: ...
# after
try:
result = provider.execute_code(instance_id, code, "python")
except RuntimeError as e:
if "HTTP 5" in str(e) or "HTTP 502" in str(e):
raise # surface, or retry after service check
raise Defensive patterns
Strategy: try-catch
Validate before calling
import requests
cfg = requests.get(f"{endpoint}/health", timeout=5)
assert cfg.status_code == 200, f"sandbox service unhealthy: {cfg.status_code}" Try / catch
try:
result = provider.execute_code(instance_id, code, "python")
except RuntimeError as e:
msg = str(e)
if msg.startswith("HTTP 5") or msg.startswith("HTTP 503"):
# transient: backoff and retry once
...
elif msg.startswith("HTTP 4"):
raise SandboxRequestRejected(msg) from e # do not retry 4xx
else:
raise Prevention
- Log the embedded response body — it is the remote service's own error detail.
- Health-check the sandbox service before execution batches.
- Keep the endpoint URL pointed at the /run API route, not a proxy/UI path.
When it happens
Trigger: Sandbox service rejecting the request payload (invalid language, oversized code_b64); executor container crashing mid-run (500); the endpoint URL pointing at a reverse proxy that returns 404/502; auth middleware returning 401/403; service overloaded returning 503.
Common situations: Wrong SANDBOX endpoint/port in config (404 from a generic web server); payload too large for a proxy's client_max_body_size (413); sandbox executor bugs surfacing as 500; service starting up or restarting during the call.
Related errors
- Execution timed out after {exec_timeout} seconds
- HTTP request failed: {str(e)}
- Provider not initialized. Call initialize() first.
- Failed to create UCloud Agent Sandbox: {exc}
- UCloud Agent Sandbox execution failed: {exc}
AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15).
Data as JSON: /api/errors/91f6400069c74966.
Report an issue: GitHub.