ComposioHQ/composio · error · ValidationError

proxy_execute: method must be one of {sorted(_VALID_METHODS)

Error message

proxy_execute: method must be one of {sorted(_VALID_METHODS)}, got {method!r}

What it means

Client-side guard rejecting proxy_execute calls whose method is not in the allowed set (typically GET/POST/PUT/PATCH/DELETE). The message lists the valid options and echoes the offending value, so misconfigured methods are caught locally without a round-trip.

Source

Thrown at python/composio/core/models/session_context.py:58

    *,
    toolkit: str,
    endpoint: str,
    method: t.Literal["GET", "POST", "PUT", "DELETE", "PATCH"],
    body: t.Any = None,
    parameters: t.Optional[t.List[t.Dict[str, t.Any]]] = None,
) -> ToolRouterSessionProxyExecuteResponse:
    """Shared proxy execute implementation used by SessionContextImpl and ToolRouterSession.

    Projects the generated client's response model onto the SDK's own shape so
    the public return type does not move when the client is regenerated.
    """
    # Client-side validation (matches TS SessionProxyExecuteParamsSchema)
    if not toolkit:
        raise ValidationError("proxy_execute: toolkit is required")
    if not endpoint:
        raise ValidationError("proxy_execute: endpoint is required")
    if method not in _VALID_METHODS:
        raise ValidationError(
            f"proxy_execute: method must be one of {sorted(_VALID_METHODS)}, got {method!r}"
        )

    # Transform and validate parameters
    api_params: t.List[Parameter] = []
    if parameters:
        for i, p in enumerate(parameters):
            if not isinstance(p, dict) or "name" not in p or "value" not in p:
                raise ValidationError(
                    f"proxy_execute: parameters[{i}] must be a dict with 'name' and 'value' keys"
                )
            param_type = p.get("in", p.get("type", "header"))
            if param_type not in _VALID_PARAM_TYPES:
                raise ValidationError(
                    f"proxy_execute: parameters[{i}].type must be 'header' or 'query', "
                    f"got {param_type!r}"
                )
            api_params.append(

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Use an uppercase allowed method, e.g. method='GET'
  2. If accepting user input for method, validate it against the allowed set first

Example fix

# before
session.proxy_execute(toolkit='github', endpoint='/user', method='get')

# after
session.proxy_execute(toolkit='github', endpoint='/user', method='GET')
Defensive patterns

Strategy: validation

Validate before calling

ALLOWED = {'GET','POST','PUT','PATCH','DELETE'}
method = method.upper()
assert method in ALLOWED, f'method must be in {ALLOWED}'

Type guard

def is_valid_method(m: str) -> bool:
    return m.upper() in {'GET','POST','PUT','PATCH','DELETE'}

Prevention

When it happens

Trigger: Passing method='get' (lowercase), method='HEAD', or method=None to session.proxy_execute.

Common situations: Copy-pasting from HTTP snippets that use lowercase methods, or forwarding an arbitrary user-supplied method string.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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