{"record":{"id":"45c0963bc4a0641e","repo":"affaan-m/ECC","slug":"claim-requires-owner-name","errorCode":null,"errorMessage":"claim requires --owner <name>.","messagePattern":"claim requires --owner <name>\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/work-items.js","lineNumber":396,"sourceCode":"function printGithubSyncResult(payload) {\n  console.log(`GitHub sync: ${payload.repo}`);\n  console.log(`  Open PRs: ${payload.prCount}`);\n  console.log(`  Open issues: ${payload.issueCount}`);\n  console.log(`  Closed stale items: ${payload.closedCount}`);\n  if (payload.items.length === 0 && payload.closedItems.length === 0) {\n    console.log('  Work items changed: none');\n    return;\n  }\n  for (const item of [...payload.items, ...payload.closedItems]) {\n    console.log(`  - ${item.id} ${item.status}: ${item.title}`);\n  }\n}\n\n// Thin CLI adapter over the shared claimWorkItem helper, preserving the\n// flag-specific error messages (--owner / --as) for the command line.\nfunction claimWorkItemCli(store, options) {\n  if (!options.owner) {\n    throw new Error('claim requires --owner <name>.');\n  }\n  const assigneeKind = options.claimAs ? String(options.claimAs).toLowerCase() : null;\n  if (assigneeKind && assigneeKind !== 'agent' && assigneeKind !== 'human') {\n    throw new Error(\"--as must be 'agent' or 'human'.\");\n  }\n  return claimWorkItem(store, {\n    id: resolveWorkItemId(options),\n    owner: options.owner,\n    assigneeKind,\n    sessionId: options.sessionId,\n    status: options.status\n  });\n}\n\nasync function main() {\n  let store = null;\n\n  try {","sourceCodeStart":378,"sourceCodeEnd":414,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/work-items.js#L378-L414","documentation":"Thrown by claimWorkItemCli() (the CLI adapter around the shared claimWorkItem helper) when options.owner is falsy. Claiming means assigning an item to an owner, so an owner is mandatory at the CLI boundary even though the underlying helper accepts whatever it is given. This keeps the user-facing error message flag-specific.","triggerScenarios":"Running `node scripts/work-items.js claim <id>` (or `claim` with no id) without --owner <name>. Any claim invocation missing the --owner flag hits this before the shared helper is called.","commonSituations":"Assuming the owner is inferred from the current git user or session (it is not); forgetting the flag in an automation script; passing the owner as a positional rather than via --owner.","solutions":["Pass --owner: `node scripts/work-items.js claim <id> --owner alice`.","For an agent claim, combine with --as agent: `claim <id> --owner bot --as agent`.","If scripting, set options.owner before calling claimWorkItemCli."],"exampleFix":"// before\nnode scripts/work-items.js claim refactor-state-store\n\n// after\nnode scripts/work-items.js claim refactor-state-store --owner alice","handlingStrategy":"validation","validationCode":"function ensureClaimOwner(options) {\n  if (!options || !options.owner) {\n    throw new Error('claim requires --owner <name>');\n  }\n  return options;\n}\n// call before claimWorkItemCli(store, ensureClaimOwner(options))","typeGuard":"function hasClaimOwner(options) {\n  return Boolean(options && typeof options.owner === 'string' && options.owner.trim());\n}","tryCatchPattern":null,"preventionTips":["Treat --owner as required for the claim command in all scripts.","Derive owner from a trusted source (CI user, session id) and assert it is non-empty before claiming.","Do not assume the owner is inferred from git or session; it must be passed."],"tags":["cli","validation","missing-argument","claim","ownership"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}