{"record":{"id":"8ca91e95424f08e4","repo":"infiniflow/ragflow","slug":"http-request-failed-str-e","errorCode":null,"errorMessage":"HTTP request failed: {str(e)}","messagePattern":"HTTP request failed: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"agent/sandbox/providers/self_managed.py","lineNumber":181,"sourceCode":"                metadata={\n                    \"status\": result.get(\"status\"),\n                    \"time_used_ms\": result.get(\"time_used_ms\"),\n                    \"memory_used_kb\": result.get(\"memory_used_kb\"),\n                    \"detail\": result.get(\"detail\"),\n                    \"instance_id\": instance_id,\n                    \"artifacts\": result.get(\"artifacts\", []),\n                    \"result_present\": structured_result.get(\"present\", False),\n                    \"result_value\": structured_result.get(\"value\"),\n                    \"result_type\": structured_result.get(\"type\"),\n                },\n            )\n\n        except requests.Timeout:\n            execution_time = time.time() - start_time\n            raise TimeoutError(f\"Execution timed out after {exec_timeout} seconds\")\n\n        except requests.RequestException as e:\n            raise RuntimeError(f\"HTTP request failed: {str(e)}\")\n\n    def destroy_instance(self, instance_id: str) -> bool:\n        \"\"\"\n        Destroy a sandbox instance.\n\n        Note: For self-managed provider, instances are returned to the\n        internal pool automatically by executor_manager after execution.\n        This is a no-op for tracking purposes.\n\n        Args:\n            instance_id: ID of the instance to destroy\n\n        Returns:\n            True (always succeeds for self-managed)\n        \"\"\"\n        # The executor_manager manages container lifecycle internally\n        # Container is returned to pool after execution\n        return True","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/agent/sandbox/providers/self_managed.py#L163-L199","documentation":"Raised by SelfManagedProvider.execute_code() when the requests.post to {endpoint}/run fails with a requests.RequestException other than Timeout — i.e. the HTTP request never completed. Causes include DNS resolution failure, connection refused, SSL/TLS errors, and connection resets. The original exception string is embedded (RuntimeError wrapping str(e)).","triggerScenarios":"Endpoint host unresolvable (typo in config); sandbox service not listening / wrong port (Connection refused); https endpoint with self-signed or mismatched cert (SSLError); firewall or proxy resetting the connection; service crashed between health check and call.","commonSituations":"Sandbox service container not started or still booting; endpoint configured as https:// against an http-only listener; DNS entry missing in the compose network; the requests library not installed per environment (import-level, different failure) — here strictly transport-level.","solutions":["Verify the sandbox service is running and the endpoint URL/host/port in the provider config is correct (curl it from the same host/network).","For SSL errors, fix the scheme (http vs https) or provide proper certificates.","Add a health-check gate before execution (ping the service's health route) and fail with a clearer message.","Retry with backoff only for transient resets; persistent failure means config or service state, not load."],"exampleFix":"# before\nprovider.initialize({\"endpoint\": \"https://sandbox-svc:8080\"})  # SSL/wrong scheme\n\n# after\nprovider.initialize({\"endpoint\": \"http://sandbox-svc:8080\"})","handlingStrategy":"try-catch","validationCode":"import socket\nfrom urllib.parse import urlparse\nu = urlparse(endpoint)\nwith socket.create_connection((u.hostname, u.port or 80), timeout=5):\n    pass  # endpoint reachable before executing","typeGuard":null,"tryCatchPattern":"try:\n    result = provider.execute_code(instance_id, code, \"python\")\nexcept RuntimeError as e:\n    if \"HTTP request failed\" in str(e):\n        # transport-level: check service up / DNS / scheme; not retryable until fixed\n        raise SandboxUnreachable(str(e)) from e\n    raise","preventionTips":["Pre-flight the endpoint with a TCP/health check before execution.","Pin the correct scheme (http vs https) and port in config; verify with curl.","Ensure the sandbox service container is started and DNS-resolvable from the app network."],"tags":["sandbox","network","connection","self-managed-provider"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}