pbakaus/impeccable · error

Unknown action: {action} Valid: {ACTIONS.join(", ")}

Error message

Unknown action: {action}
Valid: {ACTIONS.join(", ")}

What it means

The hook admin command validates its first argument against the ACTIONS list before dispatching. If the action (defaulting to "status" when absent/empty) is not one of the known actions, run() prints "Unknown action: <action>" plus the comma-joined valid list to stderr and exits 1. This is the admin subcommand's action-name guard.

Source

Thrown at crates/hook/src/admin.rs:1269

    if parts.is_empty() {
        "No hook config or cache to remove. Already at defaults.".to_string()
    } else {
        parts.join(" ")
    }
}

/// `impeccable hooks [action] [args...]` (hook-admin.mjs main). Returns the exit code.
pub fn run(rt: &Runtime, args: &[String], io: &mut impeccable_common::Io) -> i32 {
    let action = js::to_lower_case(
        args.first()
            .map(String::as_str)
            .filter(|a| !a.is_empty())
            .unwrap_or("status"),
    );
    let rest: Vec<String> = args.iter().skip(1).cloned().collect();
    let cwd = rt.proc_cwd.clone();
    if !ACTIONS.contains(&action.as_str()) {
        io.err(&format!(
            "Unknown action: {action}\nValid: {}\n",
            ACTIONS.join(", ")
        ));
        return 1;
    }
    let out = match action.as_str() {
        "status" => Ok(status_report(rt, &cwd)),
        "on" => set_enabled(rt, &cwd, true),
        "off" => set_enabled(rt, &cwd, false),
        "ignore-rule" => add_ignore_rule(rt, &cwd, &rest),
        "ignore-file" => add_ignore_file(rt, &cwd, &rest),
        "ignore-value" => add_ignore_value(rt, &cwd, &rest),
        "reset" => Ok(reset(rt, &cwd)),
        _ => Ok(String::new()),
    };
    match out {
        Ok(text) => {
            io.out(&format!("{text}\n"));

View on GitHub (pinned to 2bc2879276)

Solutions

  1. Read the "Valid: ..." list in the message and re-run with an exact action name from it
  2. Omit the action entirely to get the default "status" behavior
  3. Check argument order — flags must come after the action, not in its position
  4. Consult the admin subcommand's help/USAGE for the authoritative action set

Example fix

// before
$ impeccable admin stat
Unknown action: stat
Valid: status, ...

// after
$ impeccable admin status
Defensive patterns

Strategy: validation

Validate before calling

// Obtain ACTIONS from the error/help surface and validate before invoking
const KNOWN = new Set(actionListFromHelp()); // e.g. includes 'status'
if (!KNOWN.has(action)) throw new Error(`unknown admin action: ${action}`);

Try / catch

const res = spawnSync('impeccable', ['admin', action, ...rest]);
if (res.status !== 0 && res.stderr.toString().startsWith('Unknown action')) {
  const valid = res.stderr.toString().match(/Valid: (.+)/)?.[1]?.split(', ');
  console.error(`pick one of: ${valid?.join(', ')}`);
}

Prevention

When it happens

Trigger: Running `impeccable hook-admin <action>` (or the equivalent admin entry point) with a misspelled or unsupported action name — anything not contained in ACTIONS, e.g. `stat`, `enable-all`, or a flag accidentally in the action position.

Common situations: Typo'd action names; scripts written against a different tool's admin verbs; passing flags like `--json` as the first argument so they are parsed as the action.

Understand the failure class

Background: "invalid argument", "unknown mode", "not supported": invalid enum-like argument errors explained — this error's family across 19 libraries.

Related errors


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