stablyai/orca · error · Error

Repo "${args.repoId}" not found

Error message

Repo "${args.repoId}" not found

What it means

Thrown by the sparsePresets:save IPC handler when store.getRepo(args.repoId) returns null. The repo must exist before a sparse-checkout preset can be attached to it. The handler then normalizes name/directories, so the repo check is the first precondition.

Source

Thrown at src/main/ipc/repos.ts:2283

    }
  )

  // ── Sparse presets ─────────────────────────────────────────────
  // Why: repo-scoped reusable directory lists for the new-workspace composer; broadcast on change so open composers refresh.

  ipcMain.handle('sparsePresets:list', (_event, args: { repoId: string }) => {
    return store.getSparsePresets(args.repoId)
  })

  ipcMain.handle(
    'sparsePresets:save',
    (
      _event,
      args: { repoId: string; id?: string; name: string; directories: string[] }
    ): SparsePreset => {
      const repo = store.getRepo(args.repoId)
      if (!repo) {
        throw new Error(`Repo "${args.repoId}" not found`)
      }
      const name = normalizeSparsePresetName(args.name)
      const directories = normalizeSparsePresetDirectories(args.directories)
      const now = Date.now()
      const existing = args.id
        ? store.getSparsePresets(args.repoId).find((preset) => preset.id === args.id)
        : undefined
      const preset: SparsePreset = {
        id: existing?.id ?? randomUUID(),
        repoId: args.repoId,
        name,
        directories,
        createdAt: existing?.createdAt ?? now,
        updatedAt: now
      }
      const saved = store.saveSparsePreset(preset)
      notifySparsePresetsChanged(mainWindow, args.repoId)
      return saved

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Subscribe to sparsePresets/repos change events and close preset editors when the repo disappears.
  2. Verify store.getRepo presence before opening the save dialog.
  3. Catch the error and discard the in-progress preset draft with a user notice.
  4. Scope preset drafts to the current repo lifecycle, not to long-lived component state.

Example fix

// before
ipc.invoke('sparsePresets:save', { repoId, name, directories })

// after
const repo = await ipc.invoke('repos:get', repoId)
if (!repo) {
  closePresetEditor()
  showNotice('This repo was removed; preset discarded.')
  return
}
ipc.invoke('sparsePresets:save', { repoId, name, directories })
Defensive patterns

Strategy: validation

Validate before calling

const repo = await ipc.invoke('repos:get', repoId)
if (!repo) {
  closePresetEditor()
  showNotice('Repo was removed; preset discarded.')
  return
}
await ipc.invoke('sparsePresets:save', { repoId, name, directories })

Type guard

function repoStillListed(repoId: string, repos: { id: string }[]): boolean {
  return repos.some((r) => r.id === repoId)
}

Try / catch

try {
  await ipc.invoke('sparsePresets:save', { repoId, name, directories })
} catch (e) {
  if (/not found/.test((e as Error).message)) {
    discardDraft(repoId)
    refreshRepos()
  } else throw e
}

Prevention

When it happens

Trigger: Saving a sparse preset for a repo that was removed, belongs to another workspace, or whose id is stale after a re-import. Also when the preset editor is left open across a repo deletion.

Common situations: Editor/dialog open during a repos:changed event that removed the repo; preset draft persisted in renderer state after workspace switch; id copied from an older session.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/8b7819fcfbde148d. Report an issue: GitHub.