Skip to main content
← Back to list
01Issue
FeatureOpenSwamp CLIPublic
AssigneesNone

Relationships

#1671 vault.get() CEL error embeds raw newline when wrapped by model resolver, producing broken output

Opened by stack72 · 8/15/2026

Summary

When a vault.get() CEL expression in a model YAML fails (e.g., vault not found), the error message contains a raw \n that breaks the single-line error output from swamp model method run.

Observed Output

Error: "Method execution failed: Failed to resolve vault expression ${{ vault.get('personal', 'OPENROUTER_API_KEY') }}: Vault 'personal' not found. Available vaults: tailscale-secrets,
                                                        hermes-secrets.\nCreate 'personal' using: swamp vault create <type> personal"

The line break between tailscale-secrets, and hermes-secrets is a raw newline embedded in the error string.

Root Cause

Two files interact:

src/domain/vaults/vault_service.ts:309–314 constructs a multi-line error:

throw new Error(
  `Vault '${vaultName}' not found. Available vaults: ${
    availableVaults.join(", ")
  }.\n` +
    `Create '${vaultName}' using: swamp vault create <type> ${vaultName}`,
);

src/domain/expressions/model_resolver.ts:1161–1165 wraps the thrown error verbatim:

throw new Error(
  `Failed to resolve vault expression ${fullMatch}: ${
    error instanceof Error ? error.message : String(error)
  }`,
);

The \n in vault_service.ts is reasonable on its own (multi-line terminal output), but once embedded into the single "Failed to resolve vault expression ..." wrapper string it produces a broken mid-sentence line break with no indentation.

Fix Options

  1. In model_resolver.ts: replace \n with when flattening the inner message:

    error.message.replace(/\n/g, " — ")
  2. In vault_service.ts: use a separator that works both standalone and embedded, e.g. ". " instead of ".\n".

  3. In model_resolver.ts: propagate the inner error as a cause and let the CLI renderer format multi-line errors, rather than embedding the message inline.

Option 3 is the cleanest but requires CLI renderer changes. Option 1 is the minimal fix.

Environment

  • swamp: current main (a648c130)
  • Reproduced on macOS running swamp model method run hermes-director up with a vault.get() expression referencing a vault not present in the current SWAMP_REPO_DIR.

Automoved by swampadmin from https://github.com/swamp-club/swamp/issues/2157

02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED

Open

8/15/2026, 7:03:04 AM

No activity in this phase yet.

03Sludge Pulse

Sign in to post a ripple.