{"record":{"id":"21dbeaef584cfb88","repo":"pbakaus/impeccable","slug":"unknown-action-use-pin-or-unpin","errorCode":null,"errorMessage":"Unknown action: {}. Use 'pin' or 'unpin'.\n","messagePattern":"Unknown action: (.+?)\\. Use 'pin' or 'unpin'\\.\n","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/context/src/pin.rs","lineNumber":223,"sourceCode":"    if let Some(dir) = &provider.skill_dir {\n        let p = jsp::join(&[dir, \"scripts\", \"command-metadata.json\"]);\n        if let Some(v) = read_json(&p) {\n            return v;\n        }\n    }\n    serde_json::from_str(COMMAND_METADATA_JSON).unwrap_or(serde_json::Value::Object(Default::default()))\n}\n\npub fn run(args: &[String], io: &mut Io) -> i32 {\n    let action = args.first().cloned();\n    let command = args.get(1).cloned();\n    let (Some(action), Some(command)) = (action.filter(|a| !a.is_empty()), command.filter(|c| !c.is_empty())) else {\n        io.out(\"Usage: impeccable pin <pin|unpin> <command>\\n\");\n        io.out(&format!(\"\\nAvailable commands: {}\\n\", VALID_COMMANDS.join(\", \")));\n        return 1;\n    };\n    if action != \"pin\" && action != \"unpin\" {\n        io.err(&format!(\"Unknown action: {}. Use 'pin' or 'unpin'.\\n\", action));\n        return 1;\n    }\n    if !VALID_COMMANDS.contains(&command.as_str()) {\n        io.err(&format!(\"Unknown command: {}\\n\", command));\n        io.err(&format!(\"Available commands: {}\\n\", VALID_COMMANDS.join(\", \")));\n        return 1;\n    }\n    let cwd = io.cwd.to_string_lossy().into_owned();\n    let root = find_project_root(&cwd);\n    if action == \"pin\" {\n        let metadata = load_metadata(io);\n        let harness_dirs = find_harness_dirs(&root);\n        let opencode_commands_dirs = find_opencode_commands_dirs(&root, io, false);\n        if harness_dirs.is_empty() && opencode_commands_dirs.is_empty() {\n            io.out(\"No harness directories with impeccable installed found.\\n\");\n            return 0;\n        }\n        let mut created = 0;","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/pbakaus/impeccable/blob/2bc2879276c1f321a53c4ca99d3371e411329b52/crates/context/src/pin.rs#L205-L241","documentation":"The pin subcommand accepts exactly two actions: `pin` and `unpin`. Any other first argument triggers this error, which then exits 1 after printing the valid options. It is a CLI argument validation guarding the action enum.","triggerScenarios":"Running `impeccable pin <action> <command>` where action is anything other than \"pin\" or \"unpin\" — e.g. `impeccable pin add ...`, `impeccable pin remove ...`, `impeccable pin list`, or a misspelled variant like `pinned`.","commonSituations":"Guessing at verb names by analogy with other CLIs (add/remove/toggle); typos; scripts written against an imagined API; confusion between the pin command and other subcommands that list or manage pinned commands.","solutions":["Use `impeccable pin <command>` to pin or `impeccable unpin <command>` to unpin — the action must be literally \"pin\" or \"unpin\".","Check the printed usage line and the Available commands list for exact spelling.","Fix typos in scripts (e.g. `pinned` → `pin`, `rm` → `unpin`).","If you intended to list pinned commands, look for a separate list/show subcommand rather than a pin action.","Run `impeccable pin` with no args to see the usage help."],"exampleFix":"// before\nimpeccable pin add review\n// Unknown action: add. Use 'pin' or 'unpin'.\n// after\nimpeccable pin review","handlingStrategy":"validation","validationCode":"const VALID_ACTIONS = [\"pin\", \"unpin\"];\nif (!VALID_ACTIONS.includes(action)) {\n  throw new Error(`pin action must be 'pin' or 'unpin', got: ${action}`);\n}","typeGuard":null,"tryCatchPattern":"const r = spawnSync(\"impeccable\", [\"pin\", action, cmd], { encoding: \"utf8\" });\nif (r.status !== 0 && /Unknown action:/.test(r.stderr)) {\n  console.error(`invalid pin action '${action}' — use pin|unpin`);\n}","preventionTips":["Only use the literal verbs pin/unpin — no add/remove/toggle aliases exist.","Consult `impeccable pin` usage output before scripting new invocations.","Fix typos like `pinned` or `un-pin` in scripts.","Centralize CLI invocations in helpers that validate action names."],"tags":["cli","invalid-argument","usage"],"backgroundTag":"invalid-enum-value","analyzedSha":"2bc2879276c1f321a53c4ca99d3371e411329b52","analyzedAt":"2026-09-08T04:51:14.109Z","contentChangedAt":"2026-09-08T04:51:14.109Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}