{"record":{"id":"95e9d4974f731a22","repo":"windmill-labs/windmill","slug":"failed-to-deploy-type-path","errorCode":null,"errorMessage":"Failed to deploy ${type} \"${path}\".","messagePattern":"Failed to deploy (.+?) \"(.+?)\"\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/copilot/chat/global/core.ts","lineNumber":7326,"sourceCode":"\t\t\t\t? await ScriptService.getScriptByPath({ workspace, path })\n\t\t\t\t: undefined\n\t\t\tassertDraftBasedOnLatest('script', path, draft.parentHash, existing?.hash, force)\n\t\t} else {\n\t\t\tconst existing = (await FlowService.existsFlowByPath({ workspace, path }))\n\t\t\t\t? await FlowService.getFlowByPath({ workspace, path })\n\t\t\t\t: undefined\n\t\t\tassertDraftBasedOnLatest('flow', path, draft.parentVersionId, existing?.version_id, force)\n\t\t}\n\t\tconst draftOnly =\n\t\t\ttype === 'flow'\n\t\t\t\t? !(await FlowService.existsFlowByPath({ workspace, path: storagePath }))\n\t\t\t\t: false\n\t\tconst result = await deployDraftToWorkspace(type, storagePath, workspace, {\n\t\t\tdraftOnly,\n\t\t\tdeploymentMessage\n\t\t})\n\t\tif (!result.success) {\n\t\t\tthrow new Error(result.error ?? `Failed to deploy ${type} \"${path}\".`)\n\t\t}\n\t} else {\n\t\tswitch (type) {\n\t\t\tcase 'schedule': {\n\t\t\t\tconst requestBody = draft.value as any\n\t\t\t\tif (await ScheduleService.existsSchedule({ workspace, path })) {\n\t\t\t\t\tawait ScheduleService.updateSchedule({ workspace, path, requestBody })\n\t\t\t\t} else {\n\t\t\t\t\tawait ScheduleService.createSchedule({ workspace, requestBody })\n\t\t\t\t}\n\t\t\t\tactions = [createOpenScheduleAction(path, requestBody.is_flow ? 'flow' : 'script')]\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase 'trigger': {\n\t\t\t\tconst service = triggerServices[triggerKind!]\n\t\t\t\tconst requestBody = draft.value as { is_flow?: boolean }\n\t\t\t\tif (await service.exists({ workspace, path })) {\n\t\t\t\t\tawait service.update({ workspace, path, requestBody })","sourceCodeStart":7308,"sourceCodeEnd":7344,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/chat/global/core.ts#L7308-L7344","documentation":"Fallback error in the chat's deployDraft tool. When the deploy path goes through deployDraftToWorkspace (the workspace-item deploy service), the tool checks result.success; if the service returned success:false, the service's own result.error is thrown — and only if that error string is missing does this generic 'Failed to deploy <type> \"<path>\".' appear. It signals the server-side deploy failed but the cause was not propagated.","triggerScenarios":"deployDraftToWorkspace(type, storagePath, workspace, { draftOnly, deploymentMessage }) returns { success: false } with an undefined/empty error field — e.g. an unexpected server failure path that didn't set a message.","commonSituations":"Server-side validation failing without a message; permission/401-adjacent failures swallowed by the service; transient backend errors during deploy; a bug in deployDraftToWorkspace that resolves success:false without an error string.","solutions":["Check the backend logs / network tab for the actual deploy request failure cause.","Retry the deploy; if it persists, verify workspace permissions and that the item type is deployable from the draft store.","Report/investigate the missing result.error in deployDraftToWorkspace — the generic message hides the real cause."],"exampleFix":"// before\nconst result = await deployDraftToWorkspace(type, path, ws, { draftOnly })\nif (!result.success) throw new Error(result.error ?? `Failed to deploy ${type} \"${path}\".`)\n// after (make the service always return an error string)\nconst result = await deployDraftToWorkspace(type, path, ws, { draftOnly })\nif (!result.success) throw new Error(result.error ?? 'unknown deploy failure')","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await deployDraft(args)\n} catch (e) {\n  if (e.message.startsWith('Failed to deploy')) {\n    // generic failure: check backend logs / network tab for the real cause\n  } else throw e\n}","preventionTips":["Ensure deployDraftToWorkspace always returns a descriptive result.error.","Watch the deploy request's response body when debugging failed deploys.","Verify workspace permissions before programmatic deploys."],"tags":["deploy","server-error","fallback-message"],"backgroundTag":"deploy-failed-unknown-cause","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"}