affaan-m/ECC · error
Missing value for --db
Error message
Missing value for --db
What it means
scripts/status.js requires a value for the --db flag (a path to the database). After the argument loop, parseArgs checks `args.includes('--db') && !parsed.dbPath` and throws "Missing value for --db" when the flag was present but no value was captured (e.g. the flag was last, or followed by another flag that the loop did not bind as its value).
Solutions
- Provide the path immediately after the flag: `--db /path/to/db.sqlite`.
- Ensure the supplying shell variable is non-empty (quote and check it).
- Omit --db entirely to use the default database location, if acceptable.
Example fix
// before node scripts/status.js --db // after node scripts/status.js --db ./data/status.db --json
Defensive patterns
Strategy: validation
Validate before calling
const dbIdx = process.argv.indexOf('--db');
if (dbIdx !== -1 && (!process.argv[dbIdx + 1] || process.argv[dbIdx + 1].startsWith('--'))) {
throw new Error('Missing value for --db');
} Try / catch
try {
runStatus(argv);
} catch (e) {
if (e.message === 'Missing value for --db') {
console.error('Usage: node scripts/status.js --db <path> [flags]');
process.exitCode = 1;
} else throw e;
} Prevention
- Always follow --db with a quoted path: `--db "${DB_PATH:?unset}"`.
- Use shell parameter expansion to fail early on unset variables.
- Keep --db/value pairs adjacent when reordering flags.
When it happens
Trigger: Running `node scripts/status.js --db` with nothing after it, or `--db --json` where --json is parsed as its own flag leaving dbPath unset.
Common situations: Forgetting the path; an empty shell variable expansion (`--db "$DB_PATH"` with DB_PATH unset); reordering flags so --db ends up last without a value.
Understand the failure class
Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.
Related errors
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/44cc44a4eb9f7295.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/status.js:67
} else if (arg === '--write') {
parsed.writePath = args[index + 1] || null;
index += 1;
} else if (arg === '--limit') {
parsed.limit = args[index + 1] || null;
index += 1;
} else if (arg === '--help' || arg === '-h') {
parsed.help = true;
} else {
throw new Error(`Unknown argument: ${arg}`);
}
}
if (parsed.json && parsed.markdown) {
throw new Error('Choose only one output format: --json or --markdown');
}
if (args.includes('--db') && !parsed.dbPath) {
throw new Error('Missing value for --db');
}
if (args.includes('--write') && !parsed.writePath) {
throw new Error('Missing value for --write');
}
if (args.includes('--limit') && !parsed.limit) {
throw new Error('Missing value for --limit');
}
return parsed;
}
function printActiveSessions(section) {
console.log(`Active sessions: ${section.activeCount}`);
if (section.sessions.length === 0) {
console.log(' - none');
return;View on GitHub (pinned to 8321021c54)