Skip to main content
← Back to list
01Issue
BugShippedSwamp CLIPublic
Assigneesstack72

Relationships

#2437 control-plane vault init failures are swallowed; `access token reveal` says "Vault '_token-secrets' not found"

Opened by swamp_lord · 9/23/2026· Shipped 9/23/2026

Summary

When the control-plane vault can't initialise (for example, because of bad datastore credentials), the real error is logged at WARN and discarded. swamp access token reveal then fails with "Vault '_token-secrets' not found. No vaults are configured", plus advice to swamp vault create <type> _token-secrets. That hides the actual problem and points to the wrong fix.

Environment

  • swamp built from main @ 1da85ec8 (20260923.175528.0-sha.1da85ec8), unmodified
  • @swamp/s3-datastore@2026.09.23.1 (MinIO), managedConfig: true
  • Also seen with CLI 20260917.193606.0 / 20260923.001003.0 against @swamp/gcs-datastore@2026.09.23.1, where the cause was expired GCP application-default credentials

Steps to reproduce

  1. A repo on a remote datastore with managed config.
  2. swamp access token mint probe-token --principal user:probe --duration 1d. The secret is stored in the remote _token-secrets.
  3. Control: swamp access token reveal probe-token --yes → the token is revealed.
  4. AWS_SECRET_ACCESS_KEY=wrong swamp access token reveal probe-token --yes → see below.
  5. Repeat step 4 with --log-level debug.

Expected

The command fails with the initialisation error, e.g. S3 headBucket failed HTTP 403 (check AWS credentials …).

Actual

Failed to read secret for token 'probe-token' from vault '_token-secrets': Vault '_token-secrets' not found. No vaults are configured.
Note: Vaults are NOT configured in .swamp.yaml. Create a vault using:
  swamp vault create <type> _token-secrets

Only visible at debug level:

[WRN] vaults·control-plane-init: Failed to initialize control-plane vault: "S3 headBucket failed HTTP 403 (check AWS credentials — …)". Token secrets will be stored in the user vault.

Full transcripts and logs are available on request.

Root cause (on main)

  • src/domain/vaults/control_plane_vault_init.ts: initializeControlPlaneVault wraps provider.initialize() in try/catch, logs a WARN and returns null, so _token-secrets is never registered via VaultService.registerGlobalProvider.
  • src/cli/commands/access_token_reveal.ts (≈L90–96) ignores the null, builds VaultService.fromRepository, and the lookup fails as "not found".

Suggested fix

When the control plane is remote (hasRemote), propagate the initialisation error, or have commands that need _token-secrets fail with it instead of "not found". Don't suggest vault create for the reserved _token-secrets name.

#2324 (open): the control-plane encryption key is stored beside the ciphertext. #1859 (shipped): reveal docs.

Reproduction configuration

Test environment

swamp built from main @ 1da85ec847ef6a8a0ce0297563b2a9fab1f4b2b8, unmodified (20260923.175528.0-sha.1da85ec8)
Datastore @swamp/s3-datastore@2026.09.23.1 on local MinIO (http://127.0.0.1:19000, bucket swamp-repro)
Vault none configured; control-plane _token-secrets only
Instances each serve instance starts with an empty HOME and a repo containing only .swamp.yaml

.swamp.yaml:

swampVersion: 20260923.175528.0
initializedAt: "2026-09-23T18:37:26.223Z"
repoId: 80c3b52b-367c-49d9-9dbb-8b922c911e0b
tools:
  - claude
gitignoreManaged: true
datastore:
  type: "@swamp/s3-datastore"
  config:
    bucket: swamp-repro
    prefix: 08-control-plane-init-error-swallowed-20260923183720
    endpoint: "http://127.0.0.1:19000"
    forcePathStyle: true
    region: us-east-1
  hydrationStrategy: lazy
  managedConfig: true
02Bog Flow
✓OPEN✓TRIAGED✓IN PROGRESS✓SHIPPEDTRIAGE+ 5 MOREREVIEW+ 17 MOREPR_MERGED+ 2 MORESESSION_SUMMARIZED

Shipped

9/23/2026, 8:52:31 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack729/23/2026, 7:40:05 PM

Sign in to post a ripple.