{"record":{"id":"866ed670ff35f65a","repo":"gitbutlerapp/gitbutler","slug":"failed-to-add-project-after-cloning","errorCode":null,"errorMessage":"Failed to add project after cloning.","messagePattern":"Failed to add project after cloning\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/desktop/src/components/onboarding/CloneForm.svelte","lineNumber":90,"sourceCode":"\n\t\ttry {\n\t\t\tconst remoteUrl = parseRemoteUrl(repositoryUrl);\n\t\t\tif (!remoteUrl) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst targetDir = await backend.joinPath(targetDirPath, remoteUrl.name);\n\n\t\t\tawait gitService.cloneRepo(repositoryUrl, targetDir);\n\n\t\t\tposthog.captureOnboarding(OnboardingEvent.ClonedProject);\n\t\t\tconst outcome = await projectsService.addProject(targetDir);\n\t\t\tif (!outcome) {\n\t\t\t\tposthog.captureOnboarding(\n\t\t\t\t\tOnboardingEvent.ClonedProjectFailed,\n\t\t\t\t\t\"Failed to add project after cloning\",\n\t\t\t\t);\n\t\t\t\tthrow new Error(\"Failed to add project after cloning.\");\n\t\t\t}\n\n\t\t\thandleAddProjectOutcome(outcome, (project) => goto(projectPath(project.id)));\n\t\t} catch (e) {\n\t\t\tSentry.captureException(e);\n\t\t\tconst errorMessage = getErrorMessage(e);\n\t\t\tposthog.captureOnboarding(OnboardingEvent.ClonedProjectFailed, e);\n\t\t\terrors.push({\n\t\t\t\tlabel: errorMessage,\n\t\t\t});\n\t\t} finally {\n\t\t\tloading = false;\n\t\t}\n\t}\n\n\tfunction handleCancel() {\n\t\tif (history.length > 0) {\n\t\t\thistory.back();","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/apps/desktop/src/components/onboarding/CloneForm.svelte#L72-L108","documentation":"Fires during onboarding after the repository was cloned successfully but projectsService.addProject returned a falsy outcome, meaning GitButler could not register the freshly cloned directory as a project. The clone itself worked; the failure is in project registration (e.g. the resulting directory is not a usable GitButler project), leaving the user with a cloned repo that is not opened in the app.","triggerScenarios":"Thrown at apps/desktop/src/components/onboarding/CloneForm.svelte:90 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the addProject logs/toast for the specific reason registration failed (invalid or unsupported repository state)","Keep the cloned directory on disk and let the user add it manually from the project list afterwards","Validate the target directory (exists, is a git repository, writable) before calling addProject"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}