{"record":{"id":"97ef12a4a6b9f4af","repo":"affaan-m/ECC","slug":"unknown-command-options-command-97ef12","errorCode":null,"errorMessage":"Unknown command: ${options.command}","messagePattern":"Unknown command: (.+?)","errorType":"validation","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/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/work-items.js#L496-L532","documentation":"The work-items CLI dispatches on options.command and throws this error when the command name matches none of its known subcommands (create, list, get, close, sync, etc.). The unknown-command check is the fall-through at the end of the dispatch chain, meaning argv parsing itself succeeded but the verb was unrecognized.","triggerScenarios":"Calling the script with an unsupported verb, e.g. `node scripts/work-items.js delete <id>` or `remove`, or an empty command (`node scripts/work-items.js` with no subcommand), or a misspelled command like `clos`.","commonSituations":"Typo in the command; guessing a command that does not exist (e.g. expecting `delete`); outdated docs referencing a renamed subcommand; forgetting the subcommand entirely so options.command is undefined.","solutions":["Run the script with no arguments or with --help to print the supported command list.","Correct the command spelling (e.g. `close` not `clos`).","Check whether the intended operation exists under a different verb (e.g. `remove` may be `close`, `sync` for GitHub sync).","If the command was recently renamed in the repo, update your scripts/aliases to the new name."],"exampleFix":"// before\nnode scripts/work-items.js delete wi-0042\n// Error: Unknown command: delete\n\n// after\nnode scripts/work-items.js close wi-0042","handlingStrategy":"validation","validationCode":"const VALID = ['create','list','get','close','sync'];\nconst cmd = process.argv[2];\nif (!VALID.includes(cmd)) { console.error(`Unsupported command: ${cmd}. Valid: ${VALID.join(', ')}`); process.exit(2); }","typeGuard":null,"tryCatchPattern":"try {\n  execSync(`node scripts/work-items.js ${cmd} ${args}`);\n} catch (e) {\n  if (String(e.stderr).startsWith('Error: Unknown command')) {\n    execSync('node scripts/work-items.js --help', { stdio: 'inherit' });\n  }\n}","preventionTips":["Run with no arguments to see supported commands before scripting against the CLI.","Don't assume CRUD verb names (delete/remove) — check the actual subcommands.","Keep internal wrappers in sync with the script's current command set."],"tags":["cli","invalid-command"],"backgroundTag":"invalid-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"}