{"record":{"id":"13df4f16052881ab","repo":"windmill-labs/windmill","slug":"failed-to-create-schedule-requestbody-path","errorCode":null,"errorMessage":"Failed to create schedule \"${requestBody.path}\": ${formatToolError(error)}","messagePattern":"Failed to create schedule \"(.+?)\": (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/copilot/chat/workspaceTools.ts","lineNumber":375,"sourceCode":"\t\t\t})\n\t\t\ttry {\n\t\t\t\tconst result = await ScheduleService.createSchedule({ workspace, requestBody })\n\t\t\t\tconst targetKind = getActionTargetKind(requestBody.is_flow)\n\t\t\t\tconst toolResult = {\n\t\t\t\t\tsuccess: true,\n\t\t\t\t\tpath: requestBody.path,\n\t\t\t\t\ttarget_path: requestBody.script_path,\n\t\t\t\t\ttarget_kind: targetKind,\n\t\t\t\t\tbackend_result: result\n\t\t\t\t}\n\t\t\t\ttoolCallbacks.setToolStatus(toolId, {\n\t\t\t\t\tcontent: `Created schedule \"${requestBody.path}\"`,\n\t\t\t\t\tresult: toolResult,\n\t\t\t\t\tactions: [createOpenScheduleAction(requestBody.path, targetKind)]\n\t\t\t\t})\n\t\t\t\treturn JSON.stringify(toolResult)\n\t\t\t} catch (error) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Failed to create schedule \"${requestBody.path}\": ${formatToolError(error)}`\n\t\t\t\t)\n\t\t\t}\n\t\t} catch (error) {\n\t\t\treturn setToolError(toolCallbacks, toolId, error)\n\t\t}\n\t}\n}\n\nconst EMAIL_TRIGGER_DOCS = 'https://windmill.dev/docs/advanced/email_triggers'\n\ntype EmailTriggerAvailability =\n\t| { available: true; domain: string }\n\t| { available: false; hint: string }\n\n/**\n * Email triggers only work once an instance superadmin has stood up an SMTP\n * server forwarding to Windmill and set the `email_domain` global setting","sourceCodeStart":357,"sourceCodeEnd":393,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/chat/workspaceTools.ts#L357-L393","documentation":"The final leg of create_schedule — ScheduleService.createSchedule — is wrapped so any backend failure is rethrown as `Failed to create schedule \"<path>\": <detail>`. By this point the schedule body validated and the cron previewed, so this indicates a server-side rejection: path conflicts, permissions, the target script/flow missing, or transport errors.","triggerScenarios":"createSchedule returns non-2xx: a schedule with requestBody.path already exists (409/400), user lacks workspace write permission (403), the referenced script_path/is_flow target no longer exists, or a network/5xx error from the backend.","commonSituations":"Re-running a chat that already created the schedule with the same path; permission-restricted workspaces; the target script was renamed after preview; backend temporarily down.","solutions":["Pick a different schedule path or delete the existing schedule with that path first","Check you have permission to create schedules in the workspace","Confirm the target script/flow still exists and is deployed at script_path","Inspect the wrapped backend detail in the message; retry on transient 5xx/network errors"],"exampleFix":"// before\ncreate_schedule({ path: 'u/user/nightly', schedule: '0 2 * * *' }) // exists already\n// after\ncreate_schedule({ path: 'u/user/nightly_v2', schedule: '0 2 * * *' })","handlingStrategy":"try-catch","validationCode":"const existing = await ScheduleService.listSchedules({ workspace })\nif (existing.some((s) => s.path === path)) throw new Error(`Schedule ${path} already exists`)","typeGuard":null,"tryCatchPattern":"try {\n  await createSchedule(body)\n} catch (e) {\n  const msg = (e as Error).message\n  if (/already exists|duplicate/i.test(msg)) {\n    await deleteSchedule(path); return createSchedule(body)\n  }\n  if (/403|permission/i.test(msg)) throw new Error('Missing workspace permissions')\n  if (/5\\d\\d|network/i.test(msg)) return retryWithBackoff(() => createSchedule(body))\n  throw e\n}","preventionTips":["Check path uniqueness before creating","Verify the target script/flow is deployed and still exists at script_path","Ensure the workspace role allows creating schedules","Retry only transient (5xx/network) failures"],"tags":["schedules","api-error","permissions","copilot"],"backgroundTag":"api-request-failed","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"}