{"record":{"id":"464786072eb2f936","repo":"ruvnet/ruflo","slug":"invalid-target-format-target-use-agent-id-o","errorCode":null,"errorMessage":"Invalid target format: ${target}. Use agent:<id> or human:<id>","messagePattern":"Invalid target format: (.+?)\\. Use agent:<id> or human:<id>","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/claims/src/api/cli-commands.ts","lineNumber":174,"sourceCode":"  }\n\n  const hours = Math.floor(diffMs / (1000 * 60 * 60));\n  const minutes = Math.floor((diffMs % (1000 * 60 * 60)) / (1000 * 60));\n\n  if (hours < 1) {\n    return output.warning(`${minutes}m`);\n  } else if (hours < 4) {\n    return output.warning(`${hours}h ${minutes}m`);\n  }\n\n  return output.dim(`${hours}h ${minutes}m`);\n}\n\nfunction parseTarget(target: string): { id: string; type: ClaimantType } {\n  // Format: agent:coder-1 or human:alice\n  const [type, id] = target.split(':');\n  if (!type || !id || (type !== 'agent' && type !== 'human')) {\n    throw new Error(`Invalid target format: ${target}. Use agent:<id> or human:<id>`);\n  }\n  return { id, type: type as ClaimantType };\n}\n\n// ============================================\n// List Subcommand\n// ============================================\n\nconst listCommand: Command = {\n  name: 'list',\n  aliases: ['ls'],\n  description: 'List issues',\n  options: [\n    {\n      name: 'available',\n      short: 'a',\n      description: 'Show only unclaimed issues',\n      type: 'boolean',","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/ruvnet/ruflo/blob/6b01dc5a687b26b3e218f796de45ec51f8fa9e8c/v3/@claude-flow/claims/src/api/cli-commands.ts#L156-L192","documentation":"Thrown by parseTarget() in the claims CLI when the target string does not split into '<type>:<id>' with type being exactly 'agent' or 'human'. The split is naive (target.split(':')) so any value without a colon, with an empty id, or with a different prefix trips it.","triggerScenarios":"Passing a target like 'coder-1' (no prefix), 'user:alice' (wrong type), 'agent:' (empty id), ':alice' (empty type), or 'agent:coder:1' (the split takes only the first colon and discards the rest as id, but extra colons leave id containing colons which is allowed — the real failure is type/id emptiness).","commonSituations":"User typos at the CLI; copy-pasting an issue ID instead of a target; using a custom claimant type not in {agent, human}.","solutions":["Format the target as 'agent:<id>' or 'human:<id>' exactly.","Add input validation/suggestions in the CLI wrapper before calling parseTarget.","If you need a new claimant type, extend parseTarget's allowed set rather than passing an unsupported prefix."],"exampleFix":"// before\nconst t = parseTarget('coder-1'); // throws 65\n\n// after\nconst t = parseTarget('agent:coder-1');","handlingStrategy":"validation","validationCode":"function isValidTarget(t) {\n  const [type, id] = String(t).split(':');\n  return (type === 'agent' || type === 'human') && !!id;\n}","typeGuard":"function isValidTarget(t) {\n  const [type, id] = String(t).split(':');\n  return (type === 'agent' || type === 'human') && !!id;\n}","tryCatchPattern":"null","preventionTips":["Always format targets as agent:<id> or human:<id>.","Validate at the CLI argument parser before reaching parseTarget."],"tags":["cli","claims","validation","parsing","typescript"],"backgroundTag":null,"analyzedSha":"6b01dc5a687b26b3e218f796de45ec51f8fa9e8c","analyzedAt":"2026-08-12T13:20:50.148Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}