{"record":{"id":"f90b2c98a898255a","repo":"stablyai/orca","slug":"could-not-read-the-selected-path","errorCode":null,"errorMessage":"Could not read the selected path.","messagePattern":"Could not read the selected path\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/ipc/pet.ts","lineNumber":254,"sourceCode":"      BrowserWindow.fromWebContents(event.sender) ?? BrowserWindow.getFocusedWindow()\n    // Why: the bundle is a folder, but Finder may let users pick `pet.json` inside it — post-pick logic walks up to the parent.\n    const options: Electron.OpenDialogOptions = {\n      title: 'Pick a .codex-pet bundle',\n      properties: ['openFile', 'openDirectory', 'treatPackageAsDirectory']\n    }\n    const result = senderWindow\n      ? await dialog.showOpenDialog(senderWindow, options)\n      : await dialog.showOpenDialog(options)\n    if (result.canceled || result.filePaths.length === 0) {\n      return null\n    }\n    const picked = result.filePaths[0]\n    let bundleDir: string\n    try {\n      const pickedStat = await stat(picked)\n      bundleDir = pickedStat.isDirectory() ? picked : dirname(picked)\n    } catch {\n      throw new Error('Could not read the selected path.')\n    }\n\n    const manifestPath = join(bundleDir, 'pet.json')\n    let manifestStat: Awaited<ReturnType<typeof stat>>\n    try {\n      manifestStat = await stat(manifestPath)\n    } catch {\n      throw new Error('Bundle is missing pet.json.')\n    }\n    if (!manifestStat.isFile() || manifestStat.size > MAX_MANIFEST_BYTES) {\n      throw new Error('pet.json is invalid.')\n    }\n    if (await isSymlink(manifestPath)) {\n      throw new Error('pet.json must not be a symlink.')\n    }\n\n    let manifest: ResolvedPetManifest<PetManifest>\n    try {","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/ipc/pet.ts#L236-L272","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-open the bundle picker and select a bundle that still exists at its original location.","If the bundle was on external/network storage, copy the whole bundle folder to local disk first and import the local copy.","Verify read+stat permissions on the bundle folder and its pet.json.","For cloud-evicted bundles, force the sync client to materialize the folder locally."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import { stat } from 'node:fs/promises'\n\nasync function pathIsAccessible(p: string): Promise<boolean> {\n  try {\n    await stat(p)\n    return true\n  } catch {\n    return false\n  }\n}\n\nif (!(await pathIsAccessible(bundlePath))) {\n  notify('That bundle path is not accessible.')\n  return\n}","typeGuard":null,"tryCatchPattern":"try {\n  await ipcRenderer.invoke('pet:importPetBundle')\n} catch (e) {\n  if (e instanceof Error && e.message === 'Could not read the selected path.') {\n    notify('The bundle path could not be read. It may have moved or been unmounted.')\n  } else throw e\n}","preventionTips":["Copy bundles to local disk before importing.","Re-pick the bundle if the original location changed.","Confirm read+stat permissions on the bundle folder."],"tags":["ipc","pet-overlay","filesystem","electron-dialog","bundle-import"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}