can1357/oh-my-pi · warning
compare requires <before-scan-id> <after-scan-id>
Error message
compare requires <before-scan-id> <after-scan-id>
What it means
The /security compare subcommand diffs two security scans and requires exactly two scan ids. handleSecurityCommand throws this when fewer than two non-empty arguments are given to parseCommandArgs, because SecurityStore.compare(before, after) cannot run without both endpoints.
Source
Thrown at packages/coding-agent/src/slash-commands/helpers/security.ts:430
return commandConsumed();
case "export":
await exportResults(runtime, rest);
return commandConsumed();
case "validate": {
const target = findingTarget(rest);
return {
prompt: prompt
.render(validationRequestPrompt, {
findingUri: target.uri,
scanId: target.scanId,
findingId: target.findingId,
})
.trim(),
};
}
case "compare": {
const [beforeScanId, afterScanId] = parseCommandArgs(rest);
if (!beforeScanId || !afterScanId) throw new Error("compare requires <before-scan-id> <after-scan-id>");
const report = await (await SecurityStore.openForCwd(runtime.cwd)).compare(beforeScanId, afterScanId);
await runtime.output(JSON.stringify(report, null, 2));
return commandConsumed();
}
case "cloud":
await handleCloudCommand(runtime, rest);
return commandConsumed();
case "disposition":
await updateDisposition(runtime, rest);
return commandConsumed();
default:
return usage(
"Usage: /security <plan|scan|status|cancel|scans|cloud|show|import|export|validate|compare|disposition>",
runtime,
);
}
} catch (error) {
await runtime.output(`Security: ${errorMessage(error)}`);View on GitHub (pinned to 9690622007)
Solutions
- Run `/security compare <before-scan-id> <after-scan-id>` with both ids separated by whitespace
- List existing scan ids via the security list/scan subcommands first
- Quote ids containing spaces so parseCommandArgs keeps them as single tokens
Example fix
// before /security compare scan-2026-08-01 // after /security compare scan-2026-08-01 scan-2026-08-30
Defensive patterns
Strategy: validation
Validate before calling
const [before, after] = parseCommandArgs(rest);
if (!before || !after) throw new Error("compare requires <before-scan-id> <after-scan-id>"); Type guard
null
Try / catch
null
Prevention
- Supply both scan ids separated by whitespace
- Fetch scan ids via the security list/scan subcommands first
- Quote ids containing spaces so argument parsing keeps them intact
When it happens
Trigger: Running `/security compare`, `/security compare <id>` (only one id), or `/security compare " "` where an argument is empty after parsing.
Common situations: User knows only one scan id, forgets the order of arguments, or pastes ids with a wrong separator so only one token parses.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- validate requires a finding URI or <scan-id> <finding-id>
- show requires a scan id or security:// URI
- import requires a SARIF file or Codex Security bundle direct
- export requires <scan-id> --output <path> [--format bundle|s
- Unknown export format: ${value}
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/98befb4c9f64af21.
Report an issue: GitHub.