windmill-labs/windmill · error
rebase_draft currently supports scripts, flows, and apps.
Error message
rebase_draft currently supports scripts, flows, and apps.
What it means
Thrown by rebaseDraft's default switch branch when the requested WorkspaceItemType is outside the supported set (script, flow, app). The rebase_draft tool computes a draft-vs-fork-base diff, which is only implemented for those three types; other item types (variables, resources, schedules, ...) are rejected outright rather than silently mishandled.
Source
Thrown at frontend/src/lib/components/copilot/chat/global/core.ts:6220
// Discard a stale draft and return its own changes (vs the fork base) as a diff so
// the model can re-apply them on the latest deploy. Discarding rather than resetting
// keeps the base pointer honest (the next write re-bases on the current head) and
// fails safe: a premature deploy hits "no draft" instead of silently shipping the
// latest unchanged.
async function rebaseDraft(
args: { type: WorkspaceItemType; path: string },
ctx: WriteDraftCtx
): Promise<string> {
switch (args.type) {
case 'script':
return rebaseScriptDraft(args.path, ctx)
case 'flow':
return rebaseFlowDraft(args.path, ctx)
case 'app':
return rebaseAppDraft(args.path, ctx)
default:
throw new Error('rebase_draft currently supports scripts, flows, and apps.')
}
}
async function rebaseScriptDraft(path: string, ctx: WriteDraftCtx): Promise<string> {
const { workspace, toolId, toolCallbacks } = ctx
const draft = await getGlobalDraft(workspace, 'script', path)
if (!draft || typeof draft.value !== 'string' || !draft.language) {
throw new Error(`No script draft found for "${path}".`)
}
if (!(await ScriptService.existsScriptByPath({ workspace, path }))) {
throw new Error(`Script "${path}" is not deployed; there is no newer version to rebase onto.`)
}
const latest = await ScriptService.getScriptByPath({ workspace, path })
const baseHash = draft.parentHash
if (baseHash && baseHash === latest.hash) {
const message = `Draft "${path}" is already based on the latest deployed version (${latest.hash}).`View on GitHub (pinned to e474e8803c)
Solutions
- Call rebase_draft only with type 'script', 'flow', or 'app'
- For other workspace item types, use the item-specific diff or discard tools instead
- If a new item type becomes draftable, extend rebaseDraft rather than passing it through
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at frontend/src/lib/components/copilot/chat/global/core.ts:6220 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/dd1d78ea1d39d0cf.
Report an issue: GitHub.