zylon-ai/private-gpt · error · ValueError

code_execution provider is not configured.

Error message

code_execution provider is not configured.

What it means

Raised by the bash tool's run_rash/run_bash closure when CodeExecutionComponent.get_or_create_session returns None. The component returns None when settings.code_execution.provider is unset or the CodeExecutionProviderRegistry has no provider registered under that name (code_execution_component.py:33-43), so the bash tool cannot create a session.

Source

Thrown at private_gpt/components/tools/builders/bash_tool_builder.py:53

    ) -> None:
        self._component = code_execution_component
        self._settings = settings

    async def build_tool(
        self,
        config: CodeExecutionSessionConfig,
        name: str = BASH_TOOL_NAME,
        type: str = BASH_TOOL_NAME + "_v1",
        description: str = BASH_TOOL_FN.metadata.description,
    ) -> ToolSpec:
        async def run_bash(
            command: str,
            timeout: int | None = None,
            restart: bool = False,
        ) -> list[ResultContentBlockType]:
            session = await self._component.get_or_create_session(config)
            if session is None:
                raise ValueError("code_execution provider is not configured.")

            result = await session.execute_bash(
                command,
                timeout=timeout,
                restart=restart,
            )
            return [
                BashCodeExecutionResultBlock(
                    stdout=truncate_output(
                        result.stdout,
                        self._settings.code_execution.max_output_bytes,
                    ),
                    stderr=truncate_output(
                        result.stderr,
                        self._settings.code_execution.max_output_bytes,
                    ),
                    return_code=result.exit_code,
                )

View on GitHub (pinned to 4a030776a3)

Solutions

  1. Set code_execution.provider in your settings to a valid provider name (e.g. the sandbox provider) and restart.
  2. Verify the provider name matches one registered in CodeExecutionProviderRegistry; check settings().code_execution.provider is non-empty.
  3. If code execution is not intended, remove/disable the bash tool from the tool set instead of leaving it half-configured.

Example fix

# settings.yaml before
code_execution: {}

# after
code_execution:
  provider: sandbox
  max_output_bytes: 10000
  session_ttl_seconds: 900
Defensive patterns

Strategy: validation

Validate before calling

from private_gpt.settings.settings import settings
from private_gpt.components.code_execution.registry import CodeExecutionProviderRegistry

s = settings()
provider_name = s.code_execution.provider
assert provider_name, "set code_execution.provider in settings"
assert CodeExecutionProviderRegistry(s).get_provider(provider_name) is not None, f"unknown provider {provider_name}"

Try / catch

try:
    result = await bash_tool(command="ls")
except ValueError as e:
    if "provider is not configured" in str(e):
        raise RuntimeError("Configure code_execution.provider before using the bash tool") from e
    raise

Prevention

When it happens

Trigger: The bash tool is invoked (built via the builder) while settings().code_execution.provider is None, empty, or names a provider that the registry does not recognize; get_or_create_session returns None and the closure raises ValueError immediately.

Common situations: Deploying with a profile/settings file that omits the code_execution block; enabling the bash tool without installing/configuring a code execution provider (e.g. sandbox); typo in the provider name in settings.yaml.

Related errors


AI-assisted analysis of zylon-ai/private-gpt@4a030776a3 (2026-08-15). Data as JSON: /api/errors/c558e63bb4955d4b. Report an issue: GitHub.