pbakaus/impeccable · error

{}

Error message

{}

What it means

This is the argument-validation funnel for the context CLI's load verb: `parse_target_options(args, true)` validates `--target` and related flags before any workspace resolution happens. On failure the returned message is printed verbatim to stderr and the process exits 1. Like error 55, the printed text is whatever the parser rejected.

Source

Thrown at crates/context/src/context_cli.rs:580

            if content.is_empty() {
                None
            } else {
                Some((n.to_string(), content))
            }
        })
        .collect()
}

// ─── cli ───────────────────────────────────────────────────────────────────

pub fn run(args: &[String], io: &mut Io) -> i32 {
    let cwd = io.cwd.to_string_lossy().into_owned();
    let env = io.env.clone();
    let provider = crate::provider::detect(&env, &cwd);
    let options = match parse_target_options(args, true) {
        Ok(o) => o,
        Err(msg) => {
            io.err(&format!("{}\n", msg));
            return 1;
        }
    };
    let target_provided = has_target_option(&options);
    // #706: resolve `--target` once, so a bare workspace name does not walk
    // the candidates twice and loadContext sees the resolved path.
    let resolved_target_path = if target_provided {
        Some(resolve_target_path(
            &cwd,
            options.target_path.as_deref().unwrap(),
            &env,
        ))
    } else {
        None
    };
    let target_exists = resolved_target_path.as_deref().map(exists);
    if let Some(sel) = resolve_target_selection(&cwd, &options, &env) {
        io.out(&format!("{}\n", build_target_selection_directive(&sel)));

View on GitHub (pinned to 2bc2879276)

Solutions

  1. Read the stderr line — the parser's message names the exact offending argument.
  2. Fix or remove the invalid `--target`/option flag; check current CLI help for accepted syntax.
  3. Quote values containing spaces or special characters so the parser receives one argument.
  4. Omit target options entirely to fall back to auto-detected defaults when a target isn't required.

Example fix

// before
context load --target "my workspace" --targets other
// <parse_target_options rejection>
// after
context load --target "my workspace"
Defensive patterns

Strategy: validation

Validate before calling

const ALLOWED = new Set(['--target', '--workspace', '--repo']);
const unknown = args.filter(a => a.startsWith('--') && !ALLOWED.has(a.split('=')[0]));
if (unknown.length) throw new Error(`unknown target options: ${unknown.join(' ')}`);
const targetIdx = args.indexOf('--target');
if (targetIdx !== -1 && (!args[targetIdx + 1] || args[targetIdx + 1].startsWith('--'))) {
  throw new Error('--target requires a value');
}

Try / catch

const res = spawnSync('context', ['load', ...args], { encoding: 'utf8' });
if (res.status !== 0 && /usage|invalid|unknown/i.test(res.stderr)) {
  console.error('Bad target options:', res.stderr.trim());
}

Prevention

When it happens

Trigger: Invoking the context load command with malformed target options: unknown flags, `--target` given an invalid value/format, mutually conflicting target options, or a value that fails `parse_target_options` validation.

Common situations: Typoed flag names in scripts; passing `--target` with old syntax after a CLI change; combining target flags that the parser rejects; quoting mistakes in shell so the flag value is empty or split.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


AI-assisted analysis of pbakaus/impeccable@2bc2879276 (2026-09-08). Data as JSON: /api/errors/38b3e8725a228535. Report an issue: GitHub.