usestrix/strix · error · ValueError

scope_id required for get

Error message

scope_id required for get

What it means

The Caido scope dispatcher routes action strings to concrete scope operations. For action='get' a scope_id must be supplied; an empty/None scope_id raises ValueError immediately, before any GraphQL call. This is argument validation, not a Caido server error.

Source

Thrown at strix/tools/proxy/caido_api.py:515

        )

    return await call_with_client(_run)


async def _scope_rules_with_client(
    client: CaidoClient,
    action: ScopeAction,
    *,
    allowlist: list[str] | None = None,
    denylist: list[str] | None = None,
    scope_id: str | None = None,
    scope_name: str | None = None,
) -> Any:
    if action == "list":
        result = await scope_list(client)
    elif action == "get":
        if not scope_id:
            raise ValueError("scope_id required for get")
        result = await scope_get(client, scope_id)
    elif action == "create":
        if not scope_name:
            raise ValueError("scope_name required for create")
        result = await scope_create(
            client,
            name=scope_name,
            allowlist=allowlist,
            denylist=denylist,
        )
    elif action == "update":
        if not scope_id or not scope_name:
            raise ValueError("scope_id and scope_name required for update")
        result = await scope_update(
            client,
            scope_id,
            name=scope_name,
            allowlist=allowlist,

View on GitHub (pinned to 8551339130)

Solutions

  1. First run action='list' to obtain scope ids.
  2. Re-issue the call with action='get' and the concrete scope_id from the listing.
  3. If scripting, assert scope_id is non-empty before invoking the dispatcher.

Example fix

# before
scope(client, "get")                       # no scope_id

# after
scopes = scope(client, "list")
scope(client, "get", scope_id=scopes[0]["id"])
Defensive patterns

Strategy: validation

Validate before calling

REQUIRED = {"get": ["scope_id"], "create": ["scope_name"],
           "update": ["scope_id", "scope_name"], "delete": ["scope_id"]}

def validate_scope_args(action, **kw) -> None:
    for field in REQUIRED.get(action, []):
        if not kw.get(field):
            raise ValueError(f"{field} required for {action}")

Try / catch

try:
    result = scope(client, action, **kwargs)
except ValueError as exc:
    if "required for" in str(exc):
        kwargs.update(fill_missing_via_list())  # e.g. resolve scope_id from action='list'
        result = scope(client, action, **kwargs)
    else:
        raise

Prevention

When it happens

Trigger: Calling the scope tool/handler with action='get' but omitting scope_id, passing an empty string, or passing a falsy value. Typically an LLM agent or script forgot the id parameter.

Common situations: Agent tool invocation missing the id argument; caller assumed 'get' with scope_name would work; empty variable expanded to '' in shell-driven calls.

Related errors


AI-assisted analysis of usestrix/strix@8551339130 (2026-08-15). Data as JSON: /api/errors/36c43ed05fbc09d5. Report an issue: GitHub.