{"record":{"id":"1aac31b0bd268439","repo":"windmill-labs/windmill","slug":"could-not-diff-type-path-entry-errormes","errorCode":null,"errorMessage":"Could not diff ${type} \"${path}\": ${entry.errorMessage}","messagePattern":"Could not diff (.+?) \"(.+?)\": (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/copilot/chat/global/core.ts","lineNumber":6597,"sourceCode":"\t\t\t\tafter: afterSide,\n\t\t\t\tvalueUncomparable\n\t\t\t} = maskVariableDiffSides(beforeSide, afterSide))\n\t\t\tflushCaveat += valueUncomparable ? SECRET_UNCOMPARABLE_NOTE : VARIABLE_MASKED_NOTE\n\t\t}\n\t\tconst parts = computeDiffParts(beforeSide, afterSide, 'deployed', 'draft')\n\t\tpatch = parts.patch\n\t\tfiles = parts.files\n\t\tflushCaveat +=\n\t\t\t'Note: this diff includes unsaved editor changes that are NOT saved to the server draft yet (auto-save is off or the last save failed).\\n\\n'\n\t} else if (flushSkipped) {\n\t\tthrow new Error(\n\t\t\t`The latest editor changes for ${type} \"${path}\" could not be saved and are not readable; retry once the editor saves.`\n\t\t)\n\t} else {\n\t\tconst entry = await readWorkspaceDiffEntry(workspace, itemKind, storagePath)\n\t\tif (entry) {\n\t\t\tif (entry.status === 'error') {\n\t\t\t\tthrow new Error(`Could not diff ${type} \"${path}\": ${entry.errorMessage}`)\n\t\t\t}\n\t\t\tpatch = entry.patch ?? ''\n\t\t\tnoDeployed = entry.noDeployed === true\n\t\t\tfiles = entry.files\n\t\t\tvalueUncomparable = entry.valueUncomparable === true\n\t\t\tif (entry.valueMasked) {\n\t\t\t\tflushCaveat += valueUncomparable ? SECRET_UNCOMPARABLE_NOTE : VARIABLE_MASKED_NOTE\n\t\t\t}\n\t\t} else {\n\t\t\t// Not in the draft listing — either no draft at all (deployed is current),\n\t\t\t// nothing at the path, or a listing/overlay disagreement; ask the overlay.\n\t\t\tlet values: Awaited<ReturnType<typeof getDraftDiffValues>>\n\t\t\ttry {\n\t\t\t\tvalues = await getDraftDiffValues(itemKind, storagePath, workspace)\n\t\t\t} catch (e) {\n\t\t\t\tif ((e as { status?: number } | null | undefined)?.status === 404) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`No ${type} found at \"${path}\" — it has neither a deployed version nor a draft.`","sourceCodeStart":6579,"sourceCodeEnd":6615,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/chat/global/core.ts#L6579-L6615","documentation":"Windmill's AI copilot `diff` tool computes a draft-vs-deployed diff for an item. Before diffing, it reads a precomputed workspace diff entry; when that entry reports status 'error', the tool surfaces the underlying diff-engine failure verbatim via this thrown Error. It is a wrapper around a server-side/overlay diff computation failure, not a usage mistake by the caller.","triggerScenarios":"Calling the copilot diff tool for a type/path whose workspace diff entry was computed with status='error'; the workspace diff overlay failed to compute the diff for that item (e.g. malformed stored content, diff computation exception), and `readWorkspaceDiffEntry` returns that error status.","commonSituations":"Corrupt or incompatible stored draft content for the item; an internal diff-engine failure for an unusual item kind; stale overlay cache after failed deploys; items whose deployed and draft sides cannot be serialized for diffing.","solutions":["Read entry.errorMessage in the message for the root cause and address that underlying failure (fix the malformed draft content or redeploy the item)","Retry the diff after the underlying item is fixed; the entry status is recomputed","If the item is broken beyond repair, delete the draft or redeploy the deployed version so a fresh diff can be computed","Report a bug with the item kind/path and errorMessage if it reproduces on healthy items"],"exampleFix":"// before: calling diff on an item with a broken draft\nawait diff({ type: 'script', path: 'f/broken_script' })\n// after: fix or clear the broken draft first, or diff after redeploying\nawait deployDraft({ path: 'f/broken_script' })\nawait diff({ type: 'script', path: 'f/broken_script' })","handlingStrategy":"try-catch","validationCode":"const entry = await readWorkspaceDiffEntry(workspace, itemKind, storagePath)\nif (entry?.status === 'error') {\n  console.warn(`Diff for ${type} \"${path}\" is in error state: ${entry.errorMessage}`)\n}","typeGuard":"function isDiffErrorEntry(entry: { status: string; errorMessage?: string } | null): entry is { status: 'error'; errorMessage: string } {\n  return entry !== null && entry.status === 'error'\n}","tryCatchPattern":"try {\n  return await diffItem({ type, path })\n} catch (e) {\n  if (String(e?.message).startsWith('Could not diff')) {\n    // underlying diff-engine failure: fix/redploy the item, then retry\n    return retryAfterFix()\n  }\n  throw e\n}","preventionTips":["Check entry.status before relying on a diff entry","Keep drafts deployable — malformed draft content breaks diff computation","Surface entry.errorMessage to users instead of swallowing it"],"tags":["diff","error-wrapping","workspace-overlay"],"backgroundTag":"diff-computation-failed","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}