stablyai/orca · error · Error

Linked work item and source context identities must match

Error message

Linked work item and source context identities must match

What it means

Thrown by normalizeLinkedWorkItemFields while preprocessing every worktrees:create (and similar) IPC payload. After Zod-parsing both fields, it asserts that a present linkedWorkItem and a present linkedTaskSourceContext refer to the same task source via isWorkspaceLinkedItemSourceContextMatch (provider equality, plus for Jira a full site/project/issue-key match). It rejects mixed-provider or identity-divergent pairs before any Git work runs.

Source

Thrown at src/main/ipc/worktrees.ts:277

  T extends {
    linkedWorkItem?: unknown
    linkedTaskSourceContext?: unknown
  }
>(input: T): T {
  const linkedWorkItem =
    input.linkedWorkItem === undefined
      ? undefined
      : NullableWorkspaceLinkedItemSchema.parse(input.linkedWorkItem)
  const linkedTaskSourceContext =
    input.linkedTaskSourceContext === undefined
      ? undefined
      : NullableTaskSourceContextSchema.parse(input.linkedTaskSourceContext)
  if (
    linkedWorkItem &&
    linkedTaskSourceContext &&
    !isWorkspaceLinkedItemSourceContextMatch(linkedWorkItem, linkedTaskSourceContext)
  ) {
    throw new Error('Linked work item and source context identities must match')
  }
  return {
    ...input,
    ...(linkedWorkItem !== undefined ? { linkedWorkItem } : {}),
    ...(linkedTaskSourceContext !== undefined ? { linkedTaskSourceContext } : {})
  }
}

async function mapWithConcurrency<T, R>(
  items: readonly T[],
  limit: number,
  fn: (item: T) => Promise<R>
): Promise<R[]> {
  const results: R[] = []
  let nextIndex = 0
  const workerCount = Math.min(limit, items.length)
  await Promise.all(
    Array.from({ length: workerCount }, async () => {

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Send linkedWorkItem and linkedTaskSourceContext that originate from the same task source, or omit one of them.
  2. For Jira, verify the item's jiraIdentifier and URL site match the context's providerIdentity.siteUrl and projectKey before submitting.
  3. Re-derive linkedTaskSourceContext from the selected linkedWorkItem in the renderer (e.g. via the same useComposerState matching helper) so they cannot drift.

Example fix

// before
invoke('worktrees:create', { repoId, linkedWorkItem: ghIssue, linkedTaskSourceContext: jiraContext })
// after
invoke('worktrees:create', { repoId, linkedWorkItem: ghIssue, linkedTaskSourceContext: ghContext })
Defensive patterns

Strategy: validation

Validate before calling

// Before invoking worktrees:create, ensure identity match client-side.
import { isWorkspaceLinkedItemSourceContextMatch } from '../../shared/workspace-linked-item-source-context'

function safeCreateArgs(args) {
  const { linkedWorkItem, linkedTaskSourceContext } = args
  if (
    linkedWorkItem &&
    linkedTaskSourceContext &&
    !isWorkspaceLinkedItemSourceContextMatch(linkedWorkItem, linkedTaskSourceContext)
  ) {
    throw new Error('linkedWorkItem and linkedTaskSourceContext disagree; fix before create')
  }
  return args
}

Type guard

function isLinkedItemContextPairConsistent(
  item: unknown,
  ctx: unknown
): boolean {
  if (!item || !ctx) return true // absent on either side is allowed
  return isWorkspaceLinkedItemSourceContextMatch(
    item as Parameters<typeof isWorkspaceLinkedItemSourceContextMatch>[0],
    ctx as Parameters<typeof isWorkspaceLinkedItemSourceContextMatch>[1]
  )
}

Prevention

When it happens

Trigger: A worktrees:create IPC call supplies linkedWorkItem and linkedTaskSourceContext together but they disagree — e.g. a GitHub issue item paired with a Jira source context, or a Jira item whose jiraIdentifier/url site differs from the context's providerIdentity (siteId/siteUrl/projectKey).

Common situations: Renderer state gets out of sync when a user switches task provider mid-form, when a Jira issue URL is pasted from a different site than the configured Jira connection, or when two different task seeds are merged into one create request.

Related errors


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