diff --git a/src/renderer/src/store/slices/repos.ts b/src/renderer/src/store/slices/repos.ts index fc38f0664fd..bca4c75997e 100644 --- a/src/renderer/src/store/slices/repos.ts +++ b/src/renderer/src/store/slices/repos.ts @@ -3,6 +3,8 @@ import { toast } from 'sonner' import type { AppState } from '../types' import type { Repo } from '../../../../shared/types' +const ERROR_TOAST_DURATION = 60_000 + export type RepoSlice = { repos: Repo[] activeRepoId: string | null @@ -58,6 +60,19 @@ export const createRepoSlice: StateCreator = (set, return repo } catch (err) { console.error('Failed to add repo:', err) + const message = err instanceof Error ? err.message : String(err) + const duration = ERROR_TOAST_DURATION + if (message.includes('Not a valid git repository')) { + toast.error('Not a git repository', { + description: 'Only git repositories can be added. Initialize one with git init first.', + duration + }) + } else { + toast.error('Failed to add repo', { + description: message, + duration + }) + } return null } },