usestrix/strix · error · ValueError

scope_id required for delete

Error message

scope_id required for delete

What it means

For action='delete' the Caido scope dispatcher requires scope_id; a missing/empty id raises ValueError before calling scope_delete. Deletion is by immutable id, not by name, to avoid ambiguity.

Source

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

        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,
            denylist=denylist,
        )
    elif action == "delete":
        if not scope_id:
            raise ValueError("scope_id required for delete")
        await scope_delete(client, scope_id)
        result = {"deleted": scope_id}
    else:
        raise ValueError(f"Unknown action: {action}")
    return result


_SITEMAP_ROOTS_QUERY = """
query GetSitemapRoots($scopeId: ID) {
    sitemapRootEntries(scopeId: $scopeId) {
        edges { node {
            id kind label hasDescendants
            metadata { ... on SitemapEntryMetadataDomain { isTls port } }
            request { method path response { statusCode } }
        } }
        count { value }
    }
}

View on GitHub (pinned to 8551339130)

Solutions

  1. Run action='list' to get the exact scope id.
  2. Call action='delete' with that scope_id.
  3. Confirm the id before deleting — the operation is destructive and immediate once issued.

Example fix

# before
scope(client, "delete", scope_name="old-scope")

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

Strategy: validation

Validate before calling

def delete_scope_by_id(client, scope_id: str | None) -> dict:
    if not scope_id:
        raise ValueError("scope_id required for delete")
    return scope(client, "delete", scope_id=scope_id)

# resolve before deleting, never delete by name
sid = next(s["id"] for s in scope(client, "list") if s["name"] == "old")

Try / catch

try:
    scope(client, "delete", scope_id=sid)
except ValueError as exc:
    if "scope_id required for delete" in str(exc):
        raise SystemExit("refusing to delete without an explicit id") from exc
    raise

Prevention

When it happens

Trigger: Calling action='delete' with only a scope_name, or with an empty scope_id. The handler refuses rather than guessing which scope to remove.

Common situations: Agent attempts delete-by-name; id variable unset in scripts; copy-paste from a create call that used names only.

Related errors


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