{"record":{"id":"f68df4533f5c0ecd","repo":"windmill-labs/windmill","slug":"cannot-diff-drafts-of-kind-itemkind","errorCode":null,"errorMessage":"Cannot diff drafts of kind ${itemKind}","messagePattern":"Cannot diff drafts of kind (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/otherUserDraftDiff.ts","lineNumber":45,"sourceCode":"\t\tcase 'flow':\n\t\t\treturn (await FlowService.getFlowByPath({ workspace, path })) as unknown as Value\n\t\tcase 'app':\n\t\t\treturn (await AppService.getAppByPath({ workspace, path, getDraft: false }))\n\t\t\t\t.value as unknown as Value\n\t\tcase 'raw_app': {\n\t\t\tconst app = await AppService.getAppByPath({ workspace, path, getDraft: false })\n\t\t\tconst v = (app.value ?? {}) as any\n\t\t\treturn {\n\t\t\t\tfiles: v.files,\n\t\t\t\trunnables: v.runnables,\n\t\t\t\tdata: extractDataConfig(v) ?? { ...DEFAULT_DATA },\n\t\t\t\tsummary: app.summary,\n\t\t\t\tpolicy: app.policy,\n\t\t\t\tcustom_path: app.custom_path\n\t\t\t} as unknown as Value\n\t\t}\n\t\tdefault:\n\t\t\tthrow new Error(`Cannot diff drafts of kind ${itemKind}`)\n\t}\n}\n","sourceCodeStart":27,"sourceCodeEnd":48,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/otherUserDraftDiff.ts#L27-L48","documentation":"fetchDeployedValueForDiff maps a draft item's kind to the deployed object it should be diffed against. The default branch throws for kinds that have no deployed-value mapping, so the diff view cannot compare that draft kind.","triggerScenarios":"Calling the draft-diff flow with an itemKind not handled by the switch (anything beyond the supported script/flow/app-style kinds) — e.g. a new draft kind added elsewhere without extending this function.","commonSituations":"A newly introduced resource kind whose diff support was not added to otherUserDraftDiff.ts; passing a malformed/undefined kind from a listing; a kind rename on the backend not mirrored here.","solutions":["Add a case for the missing kind in fetchDeployedValueForDiff that fetches its deployed value.","Filter such items out of the diff UI, showing 'diff unavailable' instead of invoking the fetch.","Verify itemKind is correct at the call site (undefined/kind mismatch is common).","If the kind was recently renamed, update the switch's case labels to the new name."],"exampleFix":"// before\ndefault: throw new Error(`Cannot diff drafts of kind ${itemKind}`)\n// after\ncase 'schedule':\n  return await ScheduleService.getSchedule({ workspace, path: item.path }) as unknown as Value\ndefault: throw new Error(`Cannot diff drafts of kind ${itemKind}`)","handlingStrategy":"validation","validationCode":"const DIFFABLE_KINDS = ['script', 'flow', 'app', 'raw_app']\nif (!DIFFABLE_KINDS.includes(itemKind)) return null // show 'diff unavailable'","typeGuard":"function canDiff(kind) { return DIFFABLE_KINDS.includes(kind) }","tryCatchPattern":"try { const deployed = await fetchDeployedValueForDiff(itemKind, item) } catch (e) { if (String(e.message).startsWith('Cannot diff drafts of kind')) showNoDiffPlaceholder(item); else throw e }","preventionTips":["Extend fetchDeployedValueForDiff whenever a new draft kind is introduced","Disable the diff action for kinds without deployed-value mapping","Log unknown kinds at the call site to catch kind renames early"],"tags":["drafts","diff","unsupported-kind"],"backgroundTag":"unsupported-draft-kind","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"}