{"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":null,"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/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/setup.rs#L175-L211","documentation":"In `init_ctx`, when the project was not found initially, the CLI runs legacy interactive setup, then retries `LegacyProject::find_by_worktree_dir`. If the project is still not registered after setup completed, this error is raised, meaning setup did not result in a persisted project record for the worktree.","triggerScenarios":"Setup prompt was accepted (SetupPromptResult other than Declined) and legacy setup ran, but LegacyProject::find_by_worktree_dir still fails for the given workdir — e.g., the app data store was not updated or the path normalized differently.","commonSituations":"GitButler app data directory missing or reset while the workspace expects a project; setup ran non-interactively and silently skipped project registration; path casing/symlink differences between workdir and stored project path.","solutions":["Open the GitButler desktop app and add the folder as a project so it is registered, then retry the CLI command.","Check that the directory you are running from matches the actual worktree path (avoid symlinked/relative paths).","Inspect the app data/project store (e.g. ~/.local/share/gitbutler) for a stale or missing projects database entry and repair or reset it.","Re-run setup in the foreground to see any swallowed setup error."],"exampleFix":"// before\n$ cd /var/symlink-to/myproject && but status\n// after\n$ cd /home/user/myproject   # real worktree path\nbut status","handlingStrategy":"retry","validationCode":"const projects = gitbutler.listProjects();\nif (!projects.some(p => fs.realpathSync(p.worktreeDir) === fs.realpathSync(cwd))) {\n  console.warn('Project not registered; register via the GitButler app first');\n}","typeGuard":null,"tryCatchPattern":"match init_ctx() {\n  Err(e) if e.to_string().contains(\"still not found\") => {\n    // fall back to interactive registration in the desktop app\n    register_project_manually(workdir)?;\n    init_ctx()\n  }\n  other => other,\n}","preventionTips":["Run CLI commands from the canonical worktree path (avoid symlinks).","Keep the GitButler app running/healthy so the project store stays consistent.","Register projects through the app before CLI automation."],"tags":["setup","project-registration","persistence","cli"],"backgroundTag":"record-not-found","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}