{"record":{"id":"8f30542a7a108315","repo":"gitbutlerapp/gitbutler","slug":"cannot-check-local-installations-not-in-a-git-rep","errorCode":null,"errorMessage":"Cannot check local installations: not in a git repository.\nUse --global to check global installations, or run from within a repository.","messagePattern":"Cannot check local installations: not in a git repository\\.\nUse --global to check global installations, or run from within a repository\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/command/skill/mod.rs","lineNumber":682,"sourceCode":"fn check_skills(\n    mut ctx: Option<&mut Context>,\n    out: &mut OutputChannel,\n    global_only: bool,\n    local_only: bool,\n    auto_update: bool,\n) -> Result<()> {\n    let t = theme::get();\n    // Determine scope\n    let (check_global, check_local) = match (global_only, local_only) {\n        (true, false) => (true, false),\n        (false, true) => (false, true),\n        (false, false) => (true, true), // default: check both\n        _ => unreachable!(),            // clap conflicts_with prevents this\n    };\n\n    // Warn if --local was explicitly requested but no repo context is available\n    if local_only && ctx.is_none() {\n        anyhow::bail!(\n            \"Cannot check local installations: not in a git repository.\\n\\\n             Use --global to check global installations, or run from within a repository.\"\n        );\n    }\n\n    // First check to find outdated skills (reborrow ctx so we can use it again later)\n    let initial_result = check_skill_status(ctx.as_deref_mut(), check_global, check_local)?;\n\n    // Collect paths of outdated skills (needed for auto-update)\n    let outdated_paths: Vec<String> = initial_result\n        .skills\n        .iter()\n        .filter(|s| !s.up_to_date)\n        .map(|s| s.path.display().to_string())\n        .collect();\n\n    // Auto-update if requested (do this before displaying results)\n    if auto_update && !outdated_paths.is_empty() {","sourceCodeStart":664,"sourceCodeEnd":700,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but/src/command/skill/mod.rs#L664-L700","documentation":"Thrown by check_skills (backs `but skill status`/`but skill update`) when --local is passed but no git repository context exists. Local skill installations live inside the current repository, so without a repo there is no local scope to inspect; the command fails fast instead of silently reporting nothing. Only the explicit --local flag triggers this - the default (both scopes) degrades gracefully.","triggerScenarios":"Running `but skill status --local` or `but skill update --local` from a directory that gix::discover cannot resolve to a git worktree, leaving ctx = None while local_only = true.","commonSituations":"Running from $HOME or /tmp, CI jobs that never cloned the repo, moving a project directory without its .git folder, shell aliases that execute but from arbitrary directories.","solutions":["Run the command from inside the target git repository","Use `but skill status --global` to check only user-level installations","Drop --local and run the plain command, which still checks the global scope without a repo"],"exampleFix":"# before (fails outside a repo)\n$ but skill status --local\n# after\n$ cd ~/my-repo && but skill status --local\n# or\n$ but skill status --global","handlingStrategy":"validation","validationCode":"fn in_git_worktree(dir: &std::path::Path) -> bool {\n    gix::discover(dir).ok().and_then(|r| r.workdir().map(|_| true)).unwrap_or(false)\n}\n// before passing --local:\nif !in_git_worktree(&cwd) { /* use --global instead of --local */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Resolve a repository with gix::discover before passing --local","In scripts, default to --global unless the cwd is a verified worktree","Treat this message as a routing hint: retry once with --global, not blindly"],"tags":["cli","git","skill","scope","local"],"backgroundTag":"not-in-git-repository","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}