{"record":{"id":"840e80570b9c6c15","repo":"pbakaus/impeccable","slug":"target-value-missing-840e80","errorCode":"TARGET_VALUE_MISSING","errorMessage":"--target requires a path value.","messagePattern":"--target requires a path value\\.","errorType":"validation","errorClass":"TargetArgError","httpStatus":null,"severity":"error","filePath":"skill/scripts/lib/target-args.mjs","lineNumber":21,"sourceCode":"    super(message);\n    this.name = 'TargetArgError';\n    this.code = code;\n  }\n}\n\nexport function parseTargetPath(args = [], { strict = false } = {}) {\n  let targetPath = null;\n  for (let i = 0; i < args.length; i++) {\n    const arg = String(args[i]);\n    if (arg === '--target' || arg === '-t') {\n      const next = args[i + 1];\n      if (next && !String(next).startsWith('-')) {\n        targetPath = String(next);\n        i++;\n        continue;\n      }\n      if (strict) {\n        throw new TargetArgError('--target requires a path value.', 'TARGET_VALUE_MISSING');\n      }\n      continue;\n    }\n    if (arg.startsWith('--target=')) {\n      const value = arg.slice('--target='.length);\n      if (value) {\n        targetPath = value;\n        continue;\n      }\n      if (strict) {\n        throw new TargetArgError('--target requires a path value.', 'TARGET_VALUE_MISSING');\n      }\n    }\n  }\n  return targetPath;\n}\n\nexport function parseTargetOptions(args = [], options = {}) {","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/pbakaus/impeccable/blob/d14711ae3d1a1dd62dee61a358d27f107c51ccd0/skill/scripts/lib/target-args.mjs#L3-L39","documentation":"Thrown by parseTargetPath() in skill/scripts/lib/target-args.mjs (strict mode) with code TARGET_VALUE_MISSING when `--target` or `-t` is followed by nothing or by a token that itself starts with `-` (another flag). In strict mode a missing path is a hard error; in non-strict mode it is silently skipped.","triggerScenarios":"Calling a command with `--target` as the last arg, or `--target --some-flag` / `-t -x` where the next token starts with `-`. Only thrown when parseTargetPath is called with { strict: true } (e.g. the apply/serve paths that require a target).","commonSituations":"Forgetting the path after --target; a shell variable expanding to a flag-like string; piping args from a script that drops the path token.","solutions":["Provide a concrete path: `--target src/pages/home.astro`.","Ensure the next token after --target does not start with `-`; quote it if needed.","If the path is optional in your context, call parseTargetPath without strict so an absent value returns null instead of throwing."],"exampleFix":"// before\nimpeccable serve --target\n// after\nimpeccable serve --target src/pages/home.astro","handlingStrategy":"validation","validationCode":"const i = args.findIndex(a => a === '--target' || a === '-t');\nif (i !== -1) {\n  const next = args[i + 1];\n  if (!next || String(next).startsWith('-')) {\n    throw new Error('--target requires a path value');\n  }\n}","typeGuard":"function targetHasValue(args) {\n  const i = args.findIndex(a => a === '--target' || a === '-t');\n  return i === -1 || (i + 1 < args.length && !String(args[i + 1]).startsWith('-'));\n}","tryCatchPattern":null,"preventionTips":["Always pair --target with its path.","Use non-strict parsing when the target is optional."],"tags":["cli","validation","target-args"],"backgroundTag":null,"analyzedSha":"d14711ae3d1a1dd62dee61a358d27f107c51ccd0","analyzedAt":"2026-08-13T00:52:25.771Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}