{"record":{"id":"08cfcf5f0cfda15c","repo":"affaan-m/ECC","slug":"missing-value-for-limit-08cfcf","errorCode":null,"errorMessage":"Missing value for --limit","messagePattern":"Missing value for --limit","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/status.js","lineNumber":71,"sourceCode":"    } 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;\n  }\n\n  for (const session of section.sessions) {\n    console.log(`  - ${session.id} [${session.harness}/${session.adapterId}] ${session.state}`);\n    console.log(`    Repo: ${session.repoRoot || '(unknown)'}`);\n    console.log(`    Started: ${session.startedAt || '(unknown)'}`);\n    console.log(`    Workers: ${session.workerCount}`);\n  }","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/status.js#L53-L89","documentation":"Thrown by scripts/status.js when --limit appears in argv but no numeric value follows it. The parser stores the next token into limit (defaulting the field to 5), and if the token is falsy the post-parse guard `args.includes('--limit') && !parsed.limit` fires. --limit controls how many active sessions, governance events, and work items are fetched, so an empty value cannot be used as a row count.","triggerScenarios":"`node scripts/status.js --limit` (flag is last token); a wrapper appending `--limit $COUNT` where $COUNT is empty or unset.","commonSituations":"A configurable row-count variable that is conditionally set and left empty in some runs; truncating a command while editing and leaving --limit dangling; copying a command template whose placeholder was never filled.","solutions":["Supply a positive integer: `node scripts/status.js --limit 20`.","If the default of 5 is acceptable, omit --limit entirely.","Fix the wrapper so it only appends `--limit <n>` when the count variable holds a valid number."],"exampleFix":"// before\nnode scripts/status.js --limit\n\n// after\nnode scripts/status.js --limit 20","handlingStrategy":"validation","validationCode":"const rawLimit = process.env.ECC_STATUS_LIMIT;\nconst limit = Number.parseInt(rawLimit, 10);\nconst args = ['--json'];\nif (Number.isFinite(limit) && limit > 0) {\n  args.push('--limit', String(limit));\n}\n// omit --limit entirely if the env var is missing or invalid","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Parse and validate numeric env vars before turning them into flags.","Omit the flag rather than pass an empty value to use the built-in default.","Treat zero or negative as 'unset', not as a valid limit."],"tags":["cli","argument-parsing","missing-value","status"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}