Skip to main content
← Back to list
01Issue
BugTriagedSwamp CLIPublic
Assigneeszack

Relationships

#4665 A corrupt extension lockfile prints a stack trace instead of a clean error

Opened by zack · 11/11/2026

Summary

When extensions/models/upstream_extensions.json cannot be read as a lockfile (invalid JSON, a non-object, or a repeated key once swamp-club#4663 lands), every extension command fails with a fatal SyntaxError and a full stack trace. In --json mode the stack trace is part of the error payload.

Reproduction

  1. swamp repo init in a temp dir.
  2. Write a lockfile containing only an opening brace and a newline.
  3. Run swamp extension list and swamp extension list --json.

Actual

Log mode prints a warning ("Skipping extension catalog repair: ...") and then a fatal line ending in SyntaxError: Cannot parse lockfile <path>: ... followed by the stack trace. JSON mode returns an object with error and stack.

Expected

A user-facing error that names the lockfile and what is wrong with it, with no stack trace (the way UserError is rendered), in both output modes. The warning and the fatal error should not repeat the same message.

Diagnosis

readUpstreamExtensions in src/infrastructure/persistence/upstream_extensions.ts throws a plain SyntaxError (marked with the lockfile path) on purpose, because callers such as the extension list retry and warnLegacyExtensionLayout catch SyntaxError to treat it as a corrupt lockfile. Nothing turns that error into a clean user error at the CLI boundary.

02Bog Flow
✓OPEN◉TRIAGED○IN PROGRESS○SHIPPED+ 1 MOREASSIGNEDCLASSIFICATION

Triaged

11/12/2026, 4:31:01 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
zack assigned zack11/12/2026, 4:30:00 PM

Sign in to post a ripple.