stablyai/orca · error · Error

Could not read the selected path.

Error message

Could not read the selected path.

What it means

Thrown by the pet:importPetBundle handler when stat(picked) rejects on the user's picked path or directory. By this point the dialog returned a path; stat failure means the path could not be inspected by the main process. The picked value can be either a directory (the bundle) or pet.json itself; the handler walks up via dirname in the success path, but that branch is never reached when stat throws.

Source

Thrown at src/main/ipc/pet.ts:254

      BrowserWindow.fromWebContents(event.sender) ?? BrowserWindow.getFocusedWindow()
    // Why: the bundle is a folder, but Finder may let users pick `pet.json` inside it — post-pick logic walks up to the parent.
    const options: Electron.OpenDialogOptions = {
      title: 'Pick a .codex-pet bundle',
      properties: ['openFile', 'openDirectory', 'treatPackageAsDirectory']
    }
    const result = senderWindow
      ? await dialog.showOpenDialog(senderWindow, options)
      : await dialog.showOpenDialog(options)
    if (result.canceled || result.filePaths.length === 0) {
      return null
    }
    const picked = result.filePaths[0]
    let bundleDir: string
    try {
      const pickedStat = await stat(picked)
      bundleDir = pickedStat.isDirectory() ? picked : dirname(picked)
    } catch {
      throw new Error('Could not read the selected path.')
    }

    const manifestPath = join(bundleDir, 'pet.json')
    let manifestStat: Awaited<ReturnType<typeof stat>>
    try {
      manifestStat = await stat(manifestPath)
    } catch {
      throw new Error('Bundle is missing pet.json.')
    }
    if (!manifestStat.isFile() || manifestStat.size > MAX_MANIFEST_BYTES) {
      throw new Error('pet.json is invalid.')
    }
    if (await isSymlink(manifestPath)) {
      throw new Error('pet.json must not be a symlink.')
    }

    let manifest: ResolvedPetManifest<PetManifest>
    try {

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Re-open the bundle picker and select a bundle that still exists at its original location.
  2. If the bundle was on external/network storage, copy the whole bundle folder to local disk first and import the local copy.
  3. Verify read+stat permissions on the bundle folder and its pet.json.
  4. For cloud-evicted bundles, force the sync client to materialize the folder locally.
Defensive patterns

Strategy: try-catch

Validate before calling

import { stat } from 'node:fs/promises'

async function pathIsAccessible(p: string): Promise<boolean> {
  try {
    await stat(p)
    return true
  } catch {
    return false
  }
}

if (!(await pathIsAccessible(bundlePath))) {
  notify('That bundle path is not accessible.')
  return
}

Try / catch

try {
  await ipcRenderer.invoke('pet:importPetBundle')
} catch (e) {
  if (e instanceof Error && e.message === 'Could not read the selected path.') {
    notify('The bundle path could not be read. It may have moved or been unmounted.')
  } else throw e
}

Prevention

When it happens

Trigger: The picked bundle folder or pet.json file was removed, moved, or became inaccessible between the dialog pick and the stat call; the path is on a disconnected external/network mount; or the main process lacks stat permission.

Common situations: User selected a .codex-pet bundle on an external drive that was unplugged mid-flow, a cloud-sync folder evicted the bundle, or the bundle was trashed/deleted right after selection.

Related errors


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