{"record":{"id":"5b020d93d7b6d4f6","repo":"windmill-labs/windmill","slug":"no-flow-draft-found-for-path","errorCode":null,"errorMessage":"No flow draft found for \"${path}\".","messagePattern":"No flow draft found for \"(.+?)\"\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/copilot/chat/global/core.ts","lineNumber":6294,"sourceCode":"\t\t\tsuccess: true,\n\t\t\tmessage:\n\t\t\t\t`Discarded the stale draft for \"${path}\". Your changes are in \"your_changes\" (a diff against the ` +\n\t\t\t\t`version you forked from). Re-apply them with edit_script / write_script — the new draft will be ` +\n\t\t\t\t`based on the latest deployed version (hash ${latest.hash}) — then deploy.`,\n\t\t\tlatest_hash: latest.hash,\n\t\t\tyour_changes: yourChanges\n\t\t},\n\t\tnull,\n\t\t2\n\t)\n}\n\nasync function rebaseFlowDraft(path: string, ctx: WriteDraftCtx): Promise<string> {\n\tconst { workspace, toolId, toolCallbacks } = ctx\n\n\tconst draft = await getGlobalDraft(workspace, 'flow', path)\n\tif (!draft || draft.value === undefined || typeof draft.value === 'string') {\n\t\tthrow new Error(`No flow draft found for \"${path}\".`)\n\t}\n\tif (!(await FlowService.existsFlowByPath({ workspace, path }))) {\n\t\tthrow new Error(`Flow \"${path}\" is not deployed; there is no newer version to rebase onto.`)\n\t}\n\n\tconst latest = await FlowService.getFlowByPath({ workspace, path })\n\tconst baseVersion = draft.parentVersionId\n\tif (baseVersion != null && baseVersion === latest.version_id) {\n\t\tconst message = `Draft \"${path}\" is already based on the latest deployed version (${latest.version_id}).`\n\t\ttoolCallbacks.setToolStatus(toolId, { content: message })\n\t\treturn JSON.stringify({\n\t\t\tsuccess: true,\n\t\t\talreadyLatest: true,\n\t\t\tlatest_version: latest.version_id,\n\t\t\tmessage\n\t\t})\n\t}\n","sourceCodeStart":6276,"sourceCodeEnd":6312,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/chat/global/core.ts#L6276-L6312","documentation":"Thrown by rebaseFlowDraft when no flow draft is stored for the path (or the draft value is a string/undefined rather than a flow object). Rebase diffs the draft against a newer deployed version; without a draft there is nothing to re-apply, so the tool refuses instead of returning a null diff.","triggerScenarios":"Thrown at frontend/src/lib/components/copilot/chat/global/core.ts:6294 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Create a flow draft with the flow edit tools before rebasing","Confirm the path matches the item you forked","If the draft was already discarded, re-apply the saved your_changes diff with the flow edit tools"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}