Skip to main content
← Back to list
01Issue
BugShippedSwamp CLIPublic
Assigneesskunk-ape

Relationships

#2555 auth token revoke exits 1 with a TypeError after swamp-club revokes the token

Opened by skunk-ape · 9/25/2026· Shipped 9/26/2026

Found while writing UAT; acceptance scenarios live in swamp-club/swamp-uat#450 (https://github.com/swamp-club/swamp-uat/issues/450).

Observed

swamp auth token revoke <id> --collective <c> for a token that exists succeeds on the server and then crashes on the client.

  • swamp-club revokes it: DELETE /api/v1/collectives/<c>/api-tokens/<id> returns 200 {"ok":true}. The token disappears from auth token list, and its key is rejected afterwards (/api/whoami returns 401).
  • The CLI exits 1 after printing:
Revoking token "<id>" from collective "<c>"...
[FTL] error: TypeError: Cannot read properties of undefined (reading 'id')

With --json it exits 1 and writes the TypeError with its stack trace to stderr.

A second revoke of the same id behaves correctly: exit 1 with Failed to revoke collective token (HTTP 422): {"error":"Token not found"}.

Observed with a swamp binary built from main (752d3384) against swamp-club main (79b28281), using the UAT registry stack.

Why it matters

Every successful revoke reports failure, so scripts and CI that check the exit code conclude the revoke failed. Revoking is what an operator does when a key has leaked, so a false failure there invites retries, escalation, or the belief that the credential is still live.

Cause

The client expects a response body the server never promised. RevokeCollectiveTokenResponse in src/infrastructure/http/swamp_club_client.ts declares { token: CollectiveTokenMetadata } and revokeCollectiveToken returns res.json() unchecked. authTokenRevoke in src/libswamp/auth/token_revoke.ts then reads response.token.id and response.token.name. swamp-club's DELETE handler has returned {"ok":true} since the endpoint was introduced. The unit tests mock revokeToken with the invented {token} shape, and revokeCollectiveToken has no client test, so the mismatch was never exercised.

Expected

A successful revoke exits 0 and says plainly that the token was revoked (log and --json). Revoking an unknown id still exits non-zero with the server's error.

02Bog Flow
✓OPEN✓TRIAGED✓IN PROGRESS✓SHIPPED+ 1 MOREASSIGNED+ 5 MOREREVIEW+ 11 MOREPR_MERGED+ 2 MORESESSION_SUMMARIZED

Shipped

9/26/2026, 2:55:17 AM

Click a lifecycle step above to view its details.

03Sludge Pulse
skunk-ape assigned skunk-ape9/25/2026, 8:38:47 PM

Sign in to post a ripple.