{"record":{"id":"9727d15a45fd751f","repo":"affaan-m/ECC","slug":"as-must-be-agent-or-human","errorCode":null,"errorMessage":"--as must be 'agent' or 'human'.","messagePattern":"--as must be 'agent' or 'human'\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/work-items.js","lineNumber":400,"sourceCode":"  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 {\n    const options = parseArgs(process.argv);\n    if (options.help) {\n      showHelp(0);\n    }","sourceCodeStart":382,"sourceCodeEnd":418,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/work-items.js#L382-L418","documentation":"claimWorkItemCli validates the --as flag, which must be exactly 'agent' or 'human' to classify the claim owner; any other or missing value is rejected in the thin CLI adapter over the shared claimWorkItem helper.","triggerScenarios":"Thrown at scripts/work-items.js:400 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use --as agent or --as human (exact lowercase match)","Omit the flag if the command applies a default claimant kind"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}