pbakaus/impeccable · error · TargetArgError

TARGET_VALUE_MISSING

TARGET_VALUE_MISSING

Error message

--target requires a path value.

What it means

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.

Source

Thrown at skill/scripts/lib/target-args.mjs:21

    super(message);
    this.name = 'TargetArgError';
    this.code = code;
  }
}

export function parseTargetPath(args = [], { strict = false } = {}) {
  let targetPath = null;
  for (let i = 0; i < args.length; i++) {
    const arg = String(args[i]);
    if (arg === '--target' || arg === '-t') {
      const next = args[i + 1];
      if (next && !String(next).startsWith('-')) {
        targetPath = String(next);
        i++;
        continue;
      }
      if (strict) {
        throw new TargetArgError('--target requires a path value.', 'TARGET_VALUE_MISSING');
      }
      continue;
    }
    if (arg.startsWith('--target=')) {
      const value = arg.slice('--target='.length);
      if (value) {
        targetPath = value;
        continue;
      }
      if (strict) {
        throw new TargetArgError('--target requires a path value.', 'TARGET_VALUE_MISSING');
      }
    }
  }
  return targetPath;
}

export function parseTargetOptions(args = [], options = {}) {

View on GitHub (pinned to d14711ae3d)

Solutions

  1. Provide a concrete path: `--target src/pages/home.astro`.
  2. Ensure the next token after --target does not start with `-`; quote it if needed.
  3. If the path is optional in your context, call parseTargetPath without strict so an absent value returns null instead of throwing.

Example fix

// before
impeccable serve --target
// after
impeccable serve --target src/pages/home.astro
Defensive patterns

Strategy: validation

Validate before calling

const i = args.findIndex(a => a === '--target' || a === '-t');
if (i !== -1) {
  const next = args[i + 1];
  if (!next || String(next).startsWith('-')) {
    throw new Error('--target requires a path value');
  }
}

Type guard

function targetHasValue(args) {
  const i = args.findIndex(a => a === '--target' || a === '-t');
  return i === -1 || (i + 1 < args.length && !String(args[i + 1]).startsWith('-'));
}

Prevention

When it happens

Trigger: 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).

Common situations: Forgetting the path after --target; a shell variable expanding to a flag-like string; piping args from a script that drops the path token.

Related errors


AI-assisted analysis of pbakaus/impeccable@d14711ae3d (2026-08-13). Data as JSON: /api/errors/840e80570b9c6c15. Report an issue: GitHub.