affaan-m/ECC · error · Error

--as must be 'agent' or 'human'.

Error message

--as must be 'agent' or 'human'.

What it means

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.

Solutions

  1. Use --as agent or --as human (exact lowercase match)
  2. Omit the flag if the command applies a default claimant kind
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at scripts/work-items.js:400 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/9727d15a45fd751f. Report an issue: GitHub.

Appendix: 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 8321021c54)