affaan-m/ECC · error · Error
--as must be 'agent' or 'human'.
Error message
--as must be 'agent' or 'human'.
What it means
Thrown by claimWorkItemCli() when options.claimAs is set but, after lowercasing, is neither 'agent' nor 'human'. The assigneeKind is forwarded to the shared claimWorkItem helper which records it on the item, so the value must be one of the two supported kinds. A null/undefined claimAs is allowed (no kind recorded); only a wrong value is rejected.
Source
Thrown at scripts/work-items.js:400
console.log(` Closed stale items: ${payload.closedCount}`);
if (payload.items.length === 0 && payload.closedItems.length === 0) {
console.log(' Work items changed: none');
return;
}
for (const item of [...payload.items, ...payload.closedItems]) {
console.log(` - ${item.id} ${item.status}: ${item.title}`);
}
}
// Thin CLI adapter over the shared claimWorkItem helper, preserving the
// flag-specific error messages (--owner / --as) for the command line.
function claimWorkItemCli(store, options) {
if (!options.owner) {
throw new Error('claim requires --owner <name>.');
}
const assigneeKind = options.claimAs ? String(options.claimAs).toLowerCase() : null;
if (assigneeKind && assigneeKind !== 'agent' && assigneeKind !== 'human') {
throw new Error("--as must be 'agent' or 'human'.");
}
return claimWorkItem(store, {
id: resolveWorkItemId(options),
owner: options.owner,
assigneeKind,
sessionId: options.sessionId,
status: options.status
});
}
async function main() {
let store = null;
try {
const options = parseArgs(process.argv);
if (options.help) {
showHelp(0);
}View on GitHub (pinned to 01e15490f0)
Solutions
- Use exactly agent or human: `claim <id> --owner alice --as human`.
- Drop the --as flag entirely if you do not need to record a kind.
- Remember the check is case-insensitive, so 'Agent' / 'HUMAN' also work.
Example fix
// before node scripts/work-items.js claim refactor-state-store --owner alice --as user // after node scripts/work-items.js claim refactor-state-store --owner alice --as human
Defensive patterns
Strategy: validation
Validate before calling
function normalizeClaimAs(value) {
if (value === undefined || value === null || value === '') return null;
const kind = String(value).toLowerCase();
if (kind !== 'agent' && kind !== 'human') {
throw new Error("--as must be 'agent' or 'human'");
}
return kind;
}
// call before claimWorkItemCli: options.claimAs = normalizeClaimAs(options.claimAs); Type guard
function isClaimAs(value) {
if (value === undefined || value === null || value === '') return true;
const k = String(value).toLowerCase();
return k === 'agent' || k === 'human';
} Prevention
- Whitelist --as to agent/human in any wrapper script.
- Remember the check is case-insensitive, so normalize before comparing.
- Drop the flag entirely when you do not need a kind rather than passing a placeholder.
When it happens
Trigger: Running claim with --as set to anything other than agent/human, e.g. `--as bot`, `--as AGENT` (ok, case-insensitive), `--as user`. Comparison is lowercased, so 'Agent' and 'Human' pass; 'users' or 'auto' do not.
Common situations: Typing --as user instead of --as human; passing a free-form role; assuming the flag accepts arbitrary assignee types.
Related errors
- claim requires --owner <name>.
- --timeout-seconds must be an integer from 10 to 120
- --host-provider must be anthropic, openai, or unknown
- ${label} must be a positive integer
- Unknown install target: ${parsed.target}. Expected one of ${
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/9727d15a45fd751f.
Report an issue: GitHub.