{"record":{"id":"3e506523c31edbca","repo":"affaan-m/ECC","slug":"missing-value-for-target-3e5065","errorCode":null,"errorMessage":"Missing value for --target","messagePattern":"Missing value for --target","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/consult.js","lineNumber":214,"sourceCode":"    target: DEFAULT_TARGET,\n    limit: DEFAULT_LIMIT,\n    json: false,\n    help: false,\n  };\n\n  if (args.includes('--help') || args.includes('-h')) {\n    parsed.help = true;\n    return parsed;\n  }\n\n  for (let index = 0; index < args.length; index += 1) {\n    const arg = args[index];\n\n    if (arg === '--json') {\n      parsed.json = true;\n    } else if (arg === '--target') {\n      if (!args[index + 1] || args[index + 1].startsWith('-')) {\n        throw new Error('Missing value for --target');\n      }\n      parsed.target = args[index + 1];\n      index += 1;\n    } else if (arg === '--limit') {\n      if (!args[index + 1]) {\n        throw new Error('Missing value for --limit');\n      }\n      parsed.limit = Math.min(parsePositiveInteger(args[index + 1], '--limit'), MAX_LIMIT);\n      index += 1;\n    } else if (arg.startsWith('-')) {\n      throw new Error(`Unknown argument: ${arg}`);\n    } else {\n      parsed.queryParts.push(arg);\n    }\n  }\n\n  if (!SUPPORTED_INSTALL_TARGETS.includes(parsed.target)) {\n    throw new Error(","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/consult.js#L196-L232","documentation":"In consult.js parseArgs(), when --target is encountered, the parser checks argv[index + 1]. If the next token is falsy (undefined, meaning --target is last) or starts with '-' (looks like another flag), it throws. This prevents silently consuming a flag name as the target value.","triggerScenarios":"Passing --target as the last argument; passing --target immediately followed by --limit or --json; or a dynamic command builder that appends --target but not its value.","commonSituations":"CI or wrapper scripts that conditionally append --target from a variable that is empty; copy-paste errors that drop the target name.","solutions":["Provide a valid target name immediately after --target, e.g. --target claude","Check the SUPPORTED_INSTALL_TARGETS list for valid values: claude, claude-project, cursor, antigravity, codex, gemini, opencode, codebuddy, joycode, qwen, zed, hermes, openclaw, kimi","If building commands dynamically, ensure the target variable is non-empty before appending --target"],"exampleFix":"// before\nnode scripts/consult.js --target --json security\n// after\nnode scripts/consult.js --target claude security","handlingStrategy":"validation","validationCode":"// Verify --target has a non-flag value before invoking consult.js\nconst argv = process.argv.slice(2);\nconst targetIdx = argv.indexOf('--target');\nif (targetIdx !== -1 && (!argv[targetIdx + 1] || argv[targetIdx + 1].startsWith('-'))) {\n  console.error('Missing value for --target. Expected one of: claude, cursor, codex, gemini, opencode, ...');\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const options = parseArgs(process.argv);\n} catch (error) {\n  if (error.message === 'Missing value for --target') {\n    console.error('Provide a target harness after --target, e.g. --target claude');\n    process.exit(2);\n  }\n  throw error;\n}","preventionTips":["Always follow --target with one of the supported harness identifiers","When building commands dynamically, verify the target variable is set and does not start with '-'","Use the default (claude) by omitting --target entirely"],"tags":["cli","argument-parsing","consult"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}