{"record":{"id":"37cd53e5b8851a4a","repo":"affaan-m/ECC","slug":"unknown-argument-arg-37cd53","errorCode":null,"errorMessage":"Unknown argument: ${arg}","messagePattern":"Unknown argument: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/sessions-cli.js","lineNumber":43,"sourceCode":"  };\n\n  for (let index = 0; index < args.length; index += 1) {\n    const arg = args[index];\n\n    if (arg === '--db') {\n      parsed.dbPath = args[index + 1] || null;\n      index += 1;\n    } else if (arg === '--json') {\n      parsed.json = true;\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 if (!arg.startsWith('--') && !parsed.sessionId) {\n      parsed.sessionId = arg;\n    } else {\n      throw new Error(`Unknown argument: ${arg}`);\n    }\n  }\n\n  return parsed;\n}\n\nfunction printSessionList(payload) {\n  console.log('Recent sessions:\\n');\n\n  if (payload.sessions.length === 0) {\n    console.log('No sessions found.');\n    return;\n  }\n\n  for (const session of payload.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)'}`);","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/sessions-cli.js#L25-L61","documentation":"Thrown by sessions-cli.js parseArgs when a token is not an accepted flag (--db, --json, --limit, --help/-h) and is not the first bare positional (which is captured as the session id). Any second positional, or any unknown flag, is rejected.","triggerScenarios":"Passing two session ids, a flag from another script (e.g. --format), or a typo like `--limt`. The first non-`--` token becomes the session id and a second one triggers the error.","commonSituations":"Pasting a session id with a trailing path; combining sessions-cli flags with setup.js flags; passing --json before the id in a way that leaves a stray token.","solutions":["Pass at most one positional session id.","Run `node scripts/sessions-cli.js --help` to confirm accepted flags.","Quote ids that contain spaces or special characters.","Move --json / --limit before the positional id to keep the command unambiguous."],"exampleFix":"# before\nnode scripts/sessions-cli.js abc123 def456 --json\n# after\nnode scripts/sessions-cli.js --json abc123","handlingStrategy":"validation","validationCode":"const ALLOWED = new Set(['--db', '--json', '--limit', '--help', '-h']);\nconst tokens = process.argv.slice(2);\nconst unknown = tokens.filter(t => t.startsWith('--') && !ALLOWED.has(t));\nconst positionals = tokens.filter(t => !t.startsWith('--'));\nif (unknown.length || positionals.length > 1) { console.error('Bad sessions-cli invocation'); process.exit(2); }","typeGuard":null,"tryCatchPattern":"try { parseArgs(process.argv); } catch (err) { console.error(err.message); process.exit(2); }","preventionTips":["Pass at most one positional id; route everything else through flags.","Pre-validate token shape in a thin wrapper before delegating."],"tags":["cli","argument-parsing","sessions-cli"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}