{"record":{"id":"888559af8c9e9e37","repo":"stablyai/orca","slug":"parent-worktree-workspace-not-found-parentworks","errorCode":null,"errorMessage":"Parent worktree workspace not found: ${parentWorkspace}","messagePattern":"Parent worktree workspace not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main/ipc/worktree-remote.ts","lineNumber":208,"sourceCode":"  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`)\n    return null\n  }\n  const parentScope = parseWorkspaceKey(args.parentWorkspace)","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/ipc/worktree-remote.ts#L190-L226","documentation":"Thrown by validateWorkspaceLineageParentBeforeCreate when the parent scope parsed as type 'worktree' but store.getWorktreeMeta(parentScope.worktreeId) returns falsy — i.e. the referenced parent worktree has no metadata in the store. This is the worktree analog of the folder case: the validator confirms the declared parent worktree exists before attaching a child, preventing orphaned lineage.","triggerScenarios":"createWorktree with a parentWorkspace key whose type is 'worktree' and whose worktreeId has no entry in store.getWorktreeMeta. The parent worktree was removed, its metadata pruned, or the ID is stale/malformed.","commonSituations":"Parent worktree was deleted (worktree remove + prune) after the child-creation flow captured its ID. Stale persisted state. Cross-session sync where the parent worktree metadata did not propagate. Race between parent removal and child creation.","solutions":["Refresh the worktree list and select a parent worktree that currently exists in the store.","If the intended parent is gone, create the new worktree at top level or under a surviving parent.","Check store.getWorktreeMeta(parentId) returns truthy before calling createWorktree."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const meta = store.getWorktreeMeta(parentScope.worktreeId)\nif (!meta) {\n  showNotification('Parent worktree no longer exists.')\n  return\n}","typeGuard":null,"tryCatchPattern":"try {\n  await createWorktree(args)\n} catch (e) {\n  if (/Parent worktree workspace not found/.test((e as Error).message)) {\n    refreshWorktreeList()\n    showNotification('That parent worktree was removed; choose another.')\n    return\n  } else throw e\n}","preventionTips":["Validate the parent worktree ID via store.getWorktreeMeta before creating a child.","Refresh the worktree list when exposing the parent picker.","Drop child-creation affordances tied to a worktree that has been removed/pruned."],"tags":["worktree","validation","lineage","worktree-workspace","not-found"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}