{"record":{"id":"b913d1df79b0ec06","repo":"stablyai/orca","slug":"parent-folder-workspace-not-found-parentworkspa","errorCode":null,"errorMessage":"Parent folder workspace not found: ${parentWorkspace}","messagePattern":"Parent folder workspace not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main/ipc/worktree-remote.ts","lineNumber":205,"sourceCode":"}\n\nfunction validateWorkspaceLineageParentBeforeCreate(\n  store: Store,\n  parentWorkspace: CreateWorktreeArgs['parentWorkspace'],\n  childWorkspaceKey: ReturnType<typeof worktreeWorkspaceKey>\n): void {\n  if (!parentWorkspace) {\n    return\n  }\n  if (parentWorkspace === childWorkspaceKey) {\n    throw new Error('A worktree cannot be attached to itself.')\n  }\n  const parentScope = parseWorkspaceKey(parentWorkspace)\n  if (!parentScope) {\n    throw new Error(`Invalid parent workspace: ${parentWorkspace}`)\n  }\n  if (parentScope.type === 'folder' && !store.getFolderWorkspace(parentScope.folderWorkspaceId)) {\n    throw new Error(`Parent folder workspace not found: ${parentWorkspace}`)\n  }\n  if (parentScope.type === 'worktree' && !store.getWorktreeMeta(parentScope.worktreeId)) {\n    throw new Error(`Parent worktree workspace not found: ${parentWorkspace}`)\n  }\n}\n\nfunction recordWorkspaceLineageForCreatedWorktree(\n  store: Store,\n  args: CreateWorktreeArgs,\n  worktree: Worktree,\n  createdAt: number\n): CreateWorktreeResult['workspaceLineage'] {\n  if (!args.parentWorkspace || !worktree.instanceId) {\n    return null\n  }\n  const childWorkspaceKey = worktreeWorkspaceKey(worktree.id)\n  if (args.parentWorkspace === childWorkspaceKey) {\n    console.warn(`[worktree-create] refusing to attach ${worktree.id} to itself`)","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/ipc/worktree-remote.ts#L187-L223","documentation":"Thrown by validateWorkspaceLineageParentBeforeCreate when the parent scope parsed as type 'folder' but store.getFolderWorkspace(parentScope.folderWorkspaceId) returns falsy — i.e. the referenced folder workspace does not exist in the store. The lineage validator confirms the declared parent actually exists before allowing a child to attach to it, preventing dangling lineage references.","triggerScenarios":"createWorktree with a parentWorkspace key whose type is 'folder' and whose folderWorkspaceId does not resolve via store.getFolderWorkspace. The folder was deleted, never created, or its ID is stale.","commonSituations":"User deleted the folder workspace after the create-child flow captured its key. A stale ID is replayed from persisted state. A sync/import produced a key referencing a folder that was not imported. ID typo or format drift.","solutions":["Refresh the folder workspace list and rebind the parent selector to an existing folder ID.","If the folder was deleted intentionally, choose a different parent or create top-level.","Validate the folder ID exists in the store before issuing createWorktree."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const folder = store.getFolderWorkspace(parentScope.folderWorkspaceId)\nif (!folder) {\n  showNotification('Parent folder workspace no longer exists.')\n  return\n}","typeGuard":null,"tryCatchPattern":"try {\n  await createWorktree(args)\n} catch (e) {\n  if (/Parent folder workspace not found/.test((e as Error).message)) {\n    refreshFolderList()\n    showNotification('That folder was deleted; choose another parent.')\n    return\n  } else throw e\n}","preventionTips":["Refresh the folder workspace list before showing the parent picker.","Validate the selected folder ID exists in the store at submit time.","Clear cached parent references when a folder is deleted."],"tags":["worktree","validation","lineage","folder-workspace","not-found"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}