gitbutlerapp/gitbutler · error · Error
Failed to add project after cloning.
Error message
Failed to add project after cloning.
What it means
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.
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
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at apps/desktop/src/components/onboarding/CloneForm.svelte:90 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/866ed670ff35f65a.
Report an issue: GitHub.
Appendix: source
Thrown at apps/desktop/src/components/onboarding/CloneForm.svelte:90
try {
const remoteUrl = parseRemoteUrl(repositoryUrl);
if (!remoteUrl) {
return;
}
const targetDir = await backend.joinPath(targetDirPath, remoteUrl.name);
await gitService.cloneRepo(repositoryUrl, targetDir);
posthog.captureOnboarding(OnboardingEvent.ClonedProject);
const outcome = await projectsService.addProject(targetDir);
if (!outcome) {
posthog.captureOnboarding(
OnboardingEvent.ClonedProjectFailed,
"Failed to add project after cloning",
);
throw new Error("Failed to add project after cloning.");
}
handleAddProjectOutcome(outcome, (project) => goto(projectPath(project.id)));
} catch (e) {
Sentry.captureException(e);
const errorMessage = getErrorMessage(e);
posthog.captureOnboarding(OnboardingEvent.ClonedProjectFailed, e);
errors.push({
label: errorMessage,
});
} finally {
loading = false;
}
}
function handleCancel() {
if (history.length > 0) {
history.back();View on GitHub (pinned to 58e5313667)