{"record":{"id":"ddae85b0ec0ccf2c","repo":"windmill-labs/windmill","slug":"invalid-schedule-or-timezone-formattoolerror-er","errorCode":null,"errorMessage":"Invalid schedule or timezone: ${formatToolError(error)}","messagePattern":"Invalid schedule or timezone: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/copilot/chat/workspaceTools.ts","lineNumber":352,"sourceCode":"\t\t\tif (dropped.length) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\tdescribeDroppedScheduleOptions(dropped)\n\t\t\t\t)\n\t\t\t}\n\n\t\t\ttoolCallbacks.setToolStatus(toolId, {\n\t\t\t\tcontent: `Validating schedule \"${requestBody.path}\"...`\n\t\t\t})\n\t\t\ttry {\n\t\t\t\tawait ScheduleService.previewSchedule({\n\t\t\t\t\trequestBody: {\n\t\t\t\t\t\tschedule: requestBody.schedule,\n\t\t\t\t\t\ttimezone: requestBody.timezone,\n\t\t\t\t\t\tcron_version: requestBody.cron_version ?? undefined\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t} catch (error) {\n\t\t\t\tthrow new Error(`Invalid schedule or timezone: ${formatToolError(error)}`)\n\t\t\t}\n\n\t\t\ttoolCallbacks.setToolStatus(toolId, {\n\t\t\t\tcontent: `Creating schedule \"${requestBody.path}\"...`\n\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,","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/chat/workspaceTools.ts#L334-L370","documentation":"create_schedule validates the cron expression and timezone server-side via ScheduleService.previewSchedule before creating anything. If that preview call fails (bad cron, unknown timezone, unsupported cron_version), the error is rethrown with this prefix so the model/user sees that the schedule definition itself — not the create call — was invalid.","triggerScenarios":"previewSchedule throws for requestBody.schedule, requestBody.timezone, or cron_version: syntactically invalid cron, non-5/6-field expressions the backend rejects, a timezone string not in the IANA database, or an invalid cron_version value.","commonSituations":"LLM generates an invalid cron (e.g. 'every 5 minutes' verbatim, or 6-field Quartz-style cron the server doesn't accept); user passes 'CET' or 'PST' instead of 'Europe/Paris' / 'America/Los_Angeles'; wrong cron_version for the backend's cron parser.","solutions":["Fix the cron expression to a valid standard cron (e.g. */5 * * * *)","Use an exact IANA timezone name like 'America/New_York', or omit timezone","Omit cron_version unless the schema explicitly requires it","Validate locally (e.g. cron-parser) before asking the copilot to create the schedule"],"exampleFix":"// before\ncreate_schedule({ schedule: 'every 5 minutes', timezone: 'PST' })\n// after\ncreate_schedule({ schedule: '*/5 * * * *', timezone: 'America/Los_Angeles' })","handlingStrategy":"validation","validationCode":"import cronParser from 'cron-parser'\ntry { cronParser.parseExpression(schedule) } catch { throw new Error('Invalid cron') }\nif (timezone && !Intl.supportedValuesOf('timeZone').includes(timezone)) throw new Error('Invalid timezone')","typeGuard":null,"tryCatchPattern":"try {\n  await createSchedule({ schedule, timezone })\n} catch (e) {\n  if (/Invalid schedule or timezone/.test((e as Error).message)) {\n    // correct cron or IANA timezone, then retry once\n  } else throw e\n}","preventionTips":["Generate cron with a builder/parser library, never free text","Only use IANA timezone identifiers (Intl.supportedValuesOf('timeZone'))","Omit timezone for UTC defaults; omit cron_version unless required"],"tags":["cron","timezone","validation","schedules","copilot"],"backgroundTag":"invalid-cron-expression","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"}