{"record":{"id":"97ef12a4a6b9f4af","repo":"affaan-m/ECC","slug":"unknown-command-options-command-97ef12","errorCode":null,"errorMessage":"Unknown command: ${options.command}","messagePattern":"Unknown command: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/work-items.js","lineNumber":514,"sourceCode":"        console.log('No unassigned open work items to claim.');\n      } else {\n        console.log(`Claimed by ${result.item.owner}:`);\n        printWorkItem(result.item);\n      }\n      return;\n    }\n\n    if (options.command === 'sync-github') {\n      const payload = syncGithubWorkItems(store, options);\n      if (options.json) {\n        console.log(JSON.stringify(payload, null, 2));\n      } else {\n        printGithubSyncResult(payload);\n      }\n      return;\n    }\n\n    throw new Error(`Unknown command: ${options.command}`);\n  } catch (error) {\n    console.error(`Error: ${error.message}`);\n    process.exit(1);\n  } finally {\n    if (store) {\n      store.close();\n    }\n  }\n}\n\nif (require.main === module) {\n  main();\n}\n\nmodule.exports = {\n  buildUpsertPayload,\n  buildGithubIssueWorkItem,\n  buildGithubPrWorkItem,","sourceCodeStart":496,"sourceCodeEnd":532,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/work-items.js#L496-L532","documentation":"Thrown at the end of the command dispatch chain when options.command is not one of list, show, upsert, close, claim, or sync-github. parseArgs treats the first non-dash argv token as the command, so any typo or stray word becomes an unknown command rather than a silent default to list.","triggerScenarios":"Typing a subcommand wrong: `node scripts/work-items.js clsoe <id>`, `node scripts/work-items.js upsertt ...`, or passing a flag-like positional. The default command is 'list', so running the script with no command word does not hit this.","commonSituations":"Typos; using an old command name after a rename; shell alias inserting an extra token that becomes the command; copy-paste from docs that use a placeholder like `<command>`.","solutions":["Run `node scripts/work-items.js --help` to see the supported commands.","Correct the command word: list, show, upsert, close, claim, sync-github.","Make sure no leading positional (e.g. an env var expansion) is being consumed as the command."],"exampleFix":"// before\nnode scripts/work-items.js clsoe refactor-state-store\n\n// after\nnode scripts/work-items.js close refactor-state-store","handlingStrategy":"validation","validationCode":"const WORK_ITEM_COMMANDS = new Set(['list', 'show', 'upsert', 'close', 'claim', 'sync-github']);\nfunction ensureKnownCommand(cmd) {\n  if (!WORK_ITEM_COMMANDS.has(cmd)) {\n    throw new Error(`Unknown command: ${cmd}. Valid: ${[...WORK_ITEM_COMMANDS].join(', ')}`);\n  }\n  return cmd;\n}","typeGuard":"function isWorkItemCommand(cmd) {\n  return typeof cmd === 'string'\n    && ['list', 'show', 'upsert', 'close', 'claim', 'sync-github'].includes(cmd);\n}","tryCatchPattern":null,"preventionTips":["Validate the command word against the known set before dispatching.","Run --help to discover supported commands.","Make sure no stray positional is being consumed as the command token."],"tags":["cli","validation","unknown-command","dispatch"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}