BerriAI/litellm · error · NotImplementedError

arun_code must be implemented by provider

Error message

arun_code must be implemented by provider

What it means

Error "arun_code must be implemented by provider" thrown in BerriAI/litellm.

Solutions

  1. Use a provider that supports code execution in sandboxes; arun_code is abstract.
  2. Implement arun_code in the custom provider's transformation class.
  3. Verify the provider name routes to a supported sandbox provider.

When it happens

Trigger: Thrown at litellm/llms/base_llm/sandbox/transformation.py:71 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/8b18334151575c5d. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/base_llm/sandbox/transformation.py:71

        self,
        *,
        template: str | None = None,
        timeout: int | None = None,
        allow_internet_access: bool | None = None,
        api_key: str | None = None,
        **kwargs,
    ) -> ContainerHandle:
        raise NotImplementedError("acreate_sandbox must be implemented by provider")

    async def arun_code(
        self,
        *,
        container: ContainerHandle | str,
        code: str,
        api_key: str | None = None,
        **kwargs,
    ) -> CodeExecutionResult:
        raise NotImplementedError("arun_code must be implemented by provider")

    async def adelete_sandbox(
        self,
        *,
        container: ContainerHandle | str,
        api_key: str | None = None,
        **kwargs,
    ) -> bool:
        raise NotImplementedError("adelete_sandbox must be implemented by provider")

    async def _read_capped_lines(self, response: httpx.Response) -> list[str]:
        lines: Final[list[str]] = []
        total = 0
        async for line in response.aiter_lines():
            total += len(line.encode("utf-8"))
            if total > SANDBOX_MAX_OUTPUT_BYTES:
                raise ValueError(
                    f"Sandbox output exceeded {SANDBOX_MAX_OUTPUT_BYTES} bytes; aborting to avoid unbounded memory use."

View on GitHub (pinned to 77b7c6c40c)