{"record":{"id":"c8363338c61b64af","repo":"windmill-labs/windmill","slug":"no-app-draft-found-for-path","errorCode":null,"errorMessage":"No app draft found for \"${path}\".","messagePattern":"No app draft found for \"(.+?)\"\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/copilot/chat/global/core.ts","lineNumber":6367,"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 JSON diff against ` +\n\t\t\t\t`the version you forked from). Re-apply them with the flow edit tools — the new draft will be ` +\n\t\t\t\t`based on the latest deployed version (version ${latest.version_id}) — then deploy.`,\n\t\t\tlatest_version: latest.version_id,\n\t\t\tyour_changes: yourChanges\n\t\t},\n\t\tnull,\n\t\t2\n\t)\n}\n\nasync function rebaseAppDraft(path: string, ctx: WriteDraftCtx): Promise<string> {\n\tconst { workspace, toolId, toolCallbacks } = ctx\n\n\tconst draft = await getGlobalDraft(workspace, 'app', path)\n\tif (!draft || !draft.value || typeof draft.value === 'string' || !('files' in draft.value)) {\n\t\tthrow new Error(`No app draft found for \"${path}\".`)\n\t}\n\tif (!(await AppService.existsApp({ workspace, path }))) {\n\t\tthrow new Error(`App \"${path}\" is not deployed; there is no newer version to rebase onto.`)\n\t}\n\n\tconst deployed = await AppService.getAppByPath({ workspace, path })\n\tconst headVersion = deployed.versions?.[deployed.versions.length - 1]\n\tconst baseVersion = draft.parentVersionId\n\tif (baseVersion != null && baseVersion === headVersion) {\n\t\tconst message = `Draft \"${path}\" is already based on the latest deployed version (${headVersion}).`\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: headVersion,\n\t\t\tmessage\n\t\t})\n\t}","sourceCodeStart":6349,"sourceCodeEnd":6385,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/chat/global/core.ts#L6349-L6385","documentation":"Thrown by rebaseAppDraft when no app draft is stored for the path, or the draft value is a string or lacks a `files` field (i.e. not a real app draft). The app rebase returns the draft's changes versus its fork base as a diff; with no valid draft there is nothing to diff.","triggerScenarios":"Thrown at frontend/src/lib/components/copilot/chat/global/core.ts:6367 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Create an app draft (edit the app or use the app write tools) before rebasing","Verify the path points at an app that actually has a draft","If the draft was discarded, re-apply the saved your_changes diff with the app 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"}