stablyai/orca · error

Parent worktree workspace not found: ${parentWorkspace}

Error message

Parent worktree workspace not found: ${parentWorkspace}

What it means

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.

Source

Thrown at src/main/ipc/worktree-remote.ts:208

  store: Store,
  parentWorkspace: CreateWorktreeArgs['parentWorkspace'],
  childWorkspaceKey: ReturnType<typeof worktreeWorkspaceKey>
): void {
  if (!parentWorkspace) {
    return
  }
  if (parentWorkspace === childWorkspaceKey) {
    throw new Error('A worktree cannot be attached to itself.')
  }
  const parentScope = parseWorkspaceKey(parentWorkspace)
  if (!parentScope) {
    throw new Error(`Invalid parent workspace: ${parentWorkspace}`)
  }
  if (parentScope.type === 'folder' && !store.getFolderWorkspace(parentScope.folderWorkspaceId)) {
    throw new Error(`Parent folder workspace not found: ${parentWorkspace}`)
  }
  if (parentScope.type === 'worktree' && !store.getWorktreeMeta(parentScope.worktreeId)) {
    throw new Error(`Parent worktree workspace not found: ${parentWorkspace}`)
  }
}

function recordWorkspaceLineageForCreatedWorktree(
  store: Store,
  args: CreateWorktreeArgs,
  worktree: Worktree,
  createdAt: number
): CreateWorktreeResult['workspaceLineage'] {
  if (!args.parentWorkspace || !worktree.instanceId) {
    return null
  }
  const childWorkspaceKey = worktreeWorkspaceKey(worktree.id)
  if (args.parentWorkspace === childWorkspaceKey) {
    console.warn(`[worktree-create] refusing to attach ${worktree.id} to itself`)
    return null
  }
  const parentScope = parseWorkspaceKey(args.parentWorkspace)

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Refresh the worktree list and select a parent worktree that currently exists in the store.
  2. If the intended parent is gone, create the new worktree at top level or under a surviving parent.
  3. Check store.getWorktreeMeta(parentId) returns truthy before calling createWorktree.
Defensive patterns

Strategy: validation

Validate before calling

const meta = store.getWorktreeMeta(parentScope.worktreeId)
if (!meta) {
  showNotification('Parent worktree no longer exists.')
  return
}

Try / catch

try {
  await createWorktree(args)
} catch (e) {
  if (/Parent worktree workspace not found/.test((e as Error).message)) {
    refreshWorktreeList()
    showNotification('That parent worktree was removed; choose another.')
    return
  } else throw e
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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