{"record":{"id":"38bccb402cbf1b2f","repo":"gitbutlerapp/gitbutler","slug":"setup-completed-but-project-still-not-found-at","errorCode":null,"errorMessage":"Setup completed but project still not found at {}","messagePattern":"Setup completed but project still not found at (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/but/src/setup.rs","lineNumber":193,"sourceCode":"                        let message =\n                            format!(\"No GitButler project found at {}\", workdir.display());\n                        match prompt_for_setup(out, &message) {\n                            SetupPromptResult::RunSetup => {\n                                // Run setup\n                                let mut ctx = Context::from_repo_with_settings(\n                                    repo.clone(),\n                                    app_settings.clone(),\n                                )?;\n                                let mut guard = ctx.exclusive_worktree_access();\n                                crate::command::legacy::setup::repo(\n                                    &mut ctx,\n                                    &args.current_dir,\n                                    out,\n                                    guard.write_permission(),\n                                )?;\n                                // Retry finding the project after setup\n                                LegacyProject::find_by_worktree_dir(workdir).map_err(|_| {\n                                    anyhow::anyhow!(\n                                        \"Setup completed but project still not found at {}\",\n                                        workdir.display()\n                                    )\n                                })?\n                            }\n                            SetupPromptResult::Declined => {\n                                anyhow::bail!(\n                                    \"Setup required: {message} - run `but setup` to configure the project\"\n                                );\n                            }\n                        }\n                    }\n                };\n\n                // Check project setup, prompt for setup if needed\n                let mut ctx =\n                    Context::new_from_legacy_project_and_settings(&project, app_settings.clone())?;\n                {","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but/src/setup.rs#L175-L211","documentation":"An invariant check after interactive repair: setup ran (via find_or_initialize_repo) and reported success, but re-reading LegacyProject::find_by_worktree_dir still finds no project record for that worktree. The persistent project store (projects.json in the app data dir) and the filesystem disagree.","triggerScenarios":"Accepting the 'run setup' repair prompt; setup completes Ok yet the project list was not updated: the recorded worktree_dir does not match the current path spelling (symlink vs resolved), the store is read-only, or a concurrent GitButler app instance rewrote it.","commonSituations":"Worktree reached through a symlinked path so lookup by path misses; desktop app and CLI racing on the projects store; damaged or stale projects.json.","solutions":["Run `but setup` manually from the same directory, then retry the original command","Inspect the projects store (projects.json in the GitButler app data dir) and confirm the worktree_dir entry matches the real path (compare `pwd -P` with `pwd`)","Access the repo via its canonical non-symlinked path; do not run the desktop app and CLI setup at the same time","As a last resort, remove the stale entry or projects file so it is recreated cleanly (back it up first)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if LegacyProject::find_by_worktree_dir(&workdir).is_err() {\n    anyhow::bail!(\n        \"no GitButler project for {}; run `but setup` first\",\n        workdir.display()\n    );\n}","typeGuard":null,"tryCatchPattern":"When this fires, do not blindly retry the original command: verify the projects.json entry matches the resolved worktree path, fix the mismatch, then rerun setup and the command.","preventionTips":["Run but from canonical (non-symlinked) worktree paths","Do not run the GitButler desktop app and but setup concurrently","Back up projects.json before migrations"],"tags":["setup","project-store","invariant","worktree-path","persistence"],"backgroundTag":"project-state-not-persisted","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}