ComposioHQ/composio · error · RuntimeError

%s is required

Error message

%s is required

What it means

_require_value in composio_helper.py raises RuntimeError when a required value (typically an env var already fetched, like a session execute URL or proxy URL) is None or empty string. It guards the local-workbench Python helper before it can issue requests without an endpoint.

Source

Thrown at ts/packages/experimental/src/workbench/python-helpers/composio_helper.py:37

DEFAULT_INVOKE_LLM_MODEL = _INTERNAL.get("invoke_llm_model", "openai/gpt-oss-120b")
RATE_LIMIT_PATTERNS = (
    "rate limit",
    "ratelimit",
    "too many requests",
    "quota exceeded",
    "resource exhausted",
)


def _read_env(name, default=None):
    value = os.environ.get(name)
    return default if value is None or value == "" else value


def _require_value(value, label):
    if value is None or value == "":
        raise RuntimeError("%s is required" % label)
    return value


def _request_id():
    return str(uuid.uuid4())


def _session_execute_url():
    backend_url = _read_env("BACKEND_URL", "https://backend.composio.dev").rstrip("/")
    session_id = _require_value(
        _read_env("COMPOSIO_TOOLROUTER_SESSION_ID"),
        "COMPOSIO_TOOLROUTER_SESSION_ID",
    )
    encoded_session_id = urllib.parse.quote(session_id, safe="")
    return "%s/api/v3/tool_router/session/%s/execute" % (backend_url, encoded_session_id)


def _session_proxy_execute_url():

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Run the helper through experimental_createLocalWorkbenchSession so the launcher injects the required env vars
  2. Check the error's label (%s is required names the missing value) to identify the exact env var
  3. Ensure the container/sandbox environment passes through COMPOSIO_* variables (no env allowlist stripping)
  4. Update @composio/experimental — env var naming has changed across versions
Defensive patterns

Strategy: validation

Validate before calling

import os
for var in ('COMPOSIO_SESSION_EXECUTE_URL', 'COMPOSIO_SESSION_PROXY_EXECUTE_URL'):
    if not os.environ.get(var):
        raise RuntimeError(f'{var} is required; launch via experimental_createLocalWorkbenchSession')

Type guard

def _has_env(name: str) -> bool:
    v = os.environ.get(name)
    return v is not None and v != ''

Try / catch

try:
    run_composio_tool(...)
except RuntimeError as e:
    if 'is required' in str(e):
        # re-inject env or relaunch via the TS workbench launcher
    raise

Prevention

When it happens

Trigger: The helper runs _session_execute_url / _session_proxy_execute_url / run_composio_tool with the corresponding env var (set by the TS layer) unset or empty — e.g. COMPOSIO_SESSION_EXECUTE_URL not injected into the sandbox process.

Common situations: Env vars not propagated to the spawned Python process; misconfigured local workbench sandbox; stripping of env in Docker/container exec; manual invocation of the helper without the TS launcher.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28). Data as JSON: /api/errors/43f0ea3578d16f10. Report an issue: GitHub.