{"record":{"id":"44cc44a4eb9f7295","repo":"affaan-m/ECC","slug":"missing-value-for-db","errorCode":null,"errorMessage":"Missing value for --db","messagePattern":"Missing value for --db","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/status.js","lineNumber":67,"sourceCode":"    } else if (arg === '--write') {\n      parsed.writePath = args[index + 1] || null;\n      index += 1;\n    } else if (arg === '--limit') {\n      parsed.limit = args[index + 1] || null;\n      index += 1;\n    } else if (arg === '--help' || arg === '-h') {\n      parsed.help = true;\n    } else {\n      throw new Error(`Unknown argument: ${arg}`);\n    }\n  }\n\n  if (parsed.json && parsed.markdown) {\n    throw new Error('Choose only one output format: --json or --markdown');\n  }\n\n  if (args.includes('--db') && !parsed.dbPath) {\n    throw new Error('Missing value for --db');\n  }\n\n  if (args.includes('--write') && !parsed.writePath) {\n    throw new Error('Missing value for --write');\n  }\n\n  if (args.includes('--limit') && !parsed.limit) {\n    throw new Error('Missing value for --limit');\n  }\n\n  return parsed;\n}\n\nfunction printActiveSessions(section) {\n  console.log(`Active sessions: ${section.activeCount}`);\n  if (section.sessions.length === 0) {\n    console.log('  - none');\n    return;","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/status.js#L49-L85","documentation":"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).","triggerScenarios":"Running `node scripts/status.js --db` with nothing after it, or `--db --json` where --json is parsed as its own flag leaving dbPath unset.","commonSituations":"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.","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."],"exampleFix":"// before\nnode scripts/status.js --db\n// after\nnode scripts/status.js --db ./data/status.db --json","handlingStrategy":"validation","validationCode":"const dbIdx = process.argv.indexOf('--db');\nif (dbIdx !== -1 && (!process.argv[dbIdx + 1] || process.argv[dbIdx + 1].startsWith('--'))) {\n  throw new Error('Missing value for --db');\n}","typeGuard":null,"tryCatchPattern":"try {\n  runStatus(argv);\n} catch (e) {\n  if (e.message === 'Missing value for --db') {\n    console.error('Usage: node scripts/status.js --db <path> [flags]');\n    process.exitCode = 1;\n  } else throw e;\n}","preventionTips":["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."],"tags":["cli","missing-value","argument-parsing"],"backgroundTag":"missing-cli-argument","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}