{"record":{"id":"765754447c0be3fc","repo":"BerriAI/litellm","slug":"sandbox-output-exceeded-sandbox-max-output-bytes","errorCode":null,"errorMessage":"Sandbox output exceeded {SANDBOX_MAX_OUTPUT_BYTES} bytes; aborting to avoid unbounded memory use.","messagePattern":"Sandbox output exceeded (.+?) bytes; aborting to avoid unbounded memory use\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/base_llm/sandbox/transformation.py","lineNumber":88,"sourceCode":"    ) -> CodeExecutionResult:\n        raise NotImplementedError(\"arun_code must be implemented by provider\")\n\n    async def adelete_sandbox(\n        self,\n        *,\n        container: ContainerHandle | str,\n        api_key: str | None = None,\n        **kwargs,\n    ) -> bool:\n        raise NotImplementedError(\"adelete_sandbox must be implemented by provider\")\n\n    async def _read_capped_lines(self, response: httpx.Response) -> list[str]:\n        lines: Final[list[str]] = []\n        total = 0\n        async for line in response.aiter_lines():\n            total += len(line.encode(\"utf-8\"))\n            if total > SANDBOX_MAX_OUTPUT_BYTES:\n                raise ValueError(\n                    f\"Sandbox output exceeded {SANDBOX_MAX_OUTPUT_BYTES} bytes; aborting to avoid unbounded memory use.\"\n                )\n            lines.append(line)\n        return lines\n","sourceCodeStart":70,"sourceCodeEnd":93,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/base_llm/sandbox/transformation.py#L70-L93","documentation":"Guard inside _read_capped_lines: while streaming sandbox execution output, the cumulative byte count of decoded lines exceeded the SANDBOX_MAX_OUTPUT_BYTES limit, so the read is aborted to prevent unbounded memory consumption from a runaway process.","triggerScenarios":"Thrown at litellm/llms/base_llm/sandbox/transformation.py:88 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reduce the amount of output the sandboxed code produces (write to files instead of stdout).","Raise SANDBOX_MAX_OUTPUT_BYTES if larger outputs are expected and memory allows.","Truncate or paginate output within the sandboxed program."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}