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

Relationships

#3542 [nit] Inconsistent empty option values (--body= vs --title=) and dead empty-body guard in issue commands

Opened by gklijs · 10/16/2026· Shipped 10/16/2026

Severity: nit (DX only). No data loss and nothing is submitted incorrectly — the server correctly rejects empty bodies. Flagging it because the behaviour is inconsistent and a couple of guards are dead code.

Environment

  • swamp 20261014.121640.0-sha.c5d1db96
  • Linux (WSL2), bash

1. Empty option values are rejected with two different, confusing errors

swamp issue bug treats an empty value for --body and for --title inconsistently:

$ swamp --json issue bug --title "probe" --body ""
  error: Missing value for option "--body".            (exit 2)

$ swamp --json issue bug --title "probe" --body=
  error: Missing value for option "--body".            (exit 2)

$ swamp --json issue bug --title= --body "desc"
  error: No arguments allowed for command "swamp issue bug".   (exit 2)

--body= (with =) reports "Missing value", but --title= is instead parsed as a positional argument and produces "No arguments allowed for command". Expected: both should report Missing value for option "--title" / "--body" consistently — the "No arguments allowed" message is misleading about what actually went wrong.

2. Dead falsy guard for --body in the issue commands

src/cli/commands/issue_bug.ts:183

if (options.title && options.body) {
  title = options.title;
  body = options.body;
} else if (options.body && !options.title) {
  throw new UserError("--body requires --title to be specified");
} else {
  // opens the editor (or errors in --json mode)
}

Because the arg parser never lets an empty string through, options.body can never be "" here, so the branch that checks "body provided" via truthiness is effectively dead, and the documented option help ("requires --title, skips editor entirely") is only satisfied for non-empty bodies. !== undefined would express the intent. The same pattern exists at:

  • src/cli/commands/issue_feature.ts:177
  • src/cli/commands/issue_security.ts:183

Not user-visible today (the parser masks it), which is why this is a nit.

3. No client-side non-empty validation, so a whitespace-only body costs a round-trip

$ swamp --json issue bug --title "probe" --body " "
  {"error":"Failed to submit issue (HTTP 400): {\"error\":\"Body must be a non-empty string\"}"}

" " passes the CLI check (truthy) and is sent to the API, which returns HTTP 400. Trimming and rejecting an empty/whitespace --title/--body locally would avoid the request and give a clearer error.

Suggested fix (optional)

  • Use !== undefined (not truthiness) for the --title/--body guards.
  • Emit Missing value for option "--<name>" consistently for empty option values (including --title=).
  • Trim-validate --title/--body before submitting.

Reproduction (all paths error before any issue is created; nothing was submitted)

swamp --json issue bug --title "probe" --body ""
swamp --json issue bug --title "probe" --body=
swamp --json issue bug --title= --body "desc"
swamp --json issue bug --title "probe" --body " "
02Bog Flow
✓OPEN✓TRIAGED✓IN PROGRESS✓SHIPPED+ 1 MOREASSIGNED+ 6 MOREREVIEW+ 8 MOREPR_MERGED+ 2 MORESESSION_SUMMARIZED

Shipped

10/16/2026, 2:28:43 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
zack assigned zack10/16/2026, 1:39:37 PM
Editable. Press Enter to edit.

zack commented 10/16/2026, 2:28:45 PM

Thanks @gklijs for reporting this! We shipped: Fix empty --opt= option values globally: Cliffy 1.0.1 treats an empty value after = as absent and consumes the next argv token, so --title= --no-redact --body desc silently parses title=--no-redact. Add a pre-parse check in runInvocation that walks argv against the real command tree and rejects any empty value for a value-taking option (including combined short groups such as -qt=, and root options given before the subcommand word) with Cliffy wording (Missing value for option --x), consistently regardless of position. In the issue commands, replace truthiness guards with undefined checks, reject blank or whitespace-only --title/--body locally before any network call, and correct the misleading --title help text. Report the parser behavior upstream to Cliffy.. The fix has been merged and a release is on its way. We appreciate your contribution to swamp.

Sign in to post a ripple.