pbakaus/impeccable · error

no stable slug for input

Error message

no stable slug for input

What it means

The critique-storage CLI's slug subcommand converts a target or input into a stable slug for storage lookups. When `coerce_slug` cannot derive any stable slug from the given input (no usable argument, or input that doesn't map to a known target/workspace), it prints this message and exits 1. Nothing is written or looked up.

Source

Thrown at crates/context/src/critique_storage.rs:455

    });
    current.into_iter().chain(legacy).max_by(|a, b| a.path.cmp(&b.path))
}

pub fn run(args: &[String], io: &mut Io) -> i32 {
    let cwd = io.cwd.to_string_lossy().into_owned();
    let env = io.env.clone();
    let cmd = args.first().map(String::as_str).unwrap_or("");
    let rest = if args.is_empty() { &[][..] } else { &args[1..] };
    match cmd {
        "slug" => {
            let slug = slug_from_target(rest.first().map(String::as_str), &cwd);
            match slug {
                Some(s) => {
                    io.out(&format!("{}\n", s));
                    0
                }
                None => {
                    io.err("no stable slug for input\n");
                    1
                }
            }
        }
        "write" => {
            let slug_arg = rest.first().map(String::as_str).unwrap_or("");
            let slug = coerce_slug(rest.first().map(String::as_str), &cwd);
            let body_file = rest.get(1).filter(|s| !s.is_empty());
            let (Some(slug), Some(body_file)) = (slug, body_file) else {
                io.err("usage: write <slug-or-target> <body-file>\n");
                return 1;
            };
            let raw = match std::fs::read(body_file) {
                Ok(b) => String::from_utf8_lossy(&b).into_owned(),
                Err(e) => {
                    // JS: uncaught exception -> stack trace on stderr, exit 1
                    io.err(&format!("{}\n", uncaught(&node_read_error(body_file, &e))));
                    return 1;

View on GitHub (pinned to 2bc2879276)

Solutions

  1. Pass an explicit slug-or-target positional argument that resolves in your current working directory.
  2. Use an existing target/workspace name that `coerce_slug` recognizes (check what targets the context CLI can resolve).
  3. Run from the workspace root so relative targets resolve; try an absolute path.
  4. If no stable slug is derivable for this input, choose a canonical target name and reuse it consistently.

Example fix

// before
context critique slug
// no stable slug for input
// after
context critique slug my-app-web
Defensive patterns

Strategy: validation

Validate before calling

const slugInput = process.argv[3];
if (!slugInput || !slugInput.trim()) {
  console.error('usage: context critique slug <slug-or-target>');
  process.exit(2);
}

Type guard

function hasSlugArg(rest) {
  return typeof rest?.[0] === 'string' && rest[0].trim().length > 0;
}

Try / catch

const res = spawnSync('context', ['critique', 'slug', target], { encoding: 'utf8' });
if (res.status !== 0 && res.stderr.includes('no stable slug for input')) {
  console.error(`Target "${target}" has no stable slug; use a resolvable workspace name.`);
}

Prevention

When it happens

Trigger: Running the slug subcommand with no argument (`rest.first()` is None so slug_arg is empty); passing a value that `coerce_slug` cannot normalize into a stable slug (empty string, unresolvable target path, or name with no canonical mapping in the current cwd).

Common situations: Forgetting the positional argument when scripting; running from a directory where the given target name doesn't resolve to a workspace; passing a path that no longer exists; expecting slug generation from free-form text rather than a target.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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