{"record":{"id":"945b4e9dd63f65ad","repo":"paperclipai/paperclip","slug":"cron-expression-must-not-be-empty","errorCode":null,"errorMessage":"Cron expression must not be empty","messagePattern":"Cron expression must not be empty","errorType":"validation","errorClass":"Error","httpStatus":422,"severity":"error","filePath":"server/src/services/cron.ts","lineNumber":207,"sourceCode":"\n/**\n * Parse a cron expression string into a structured {@link ParsedCron}.\n *\n * @param expression — A standard 5-field cron expression.\n * @returns Parsed cron with sorted valid values for each field.\n * @throws {Error} on invalid syntax.\n *\n * @example\n * ```ts\n * const parsed = parseCron(\"0 * * * *\"); // every hour at minute 0\n * // parsed.minutes === [0]\n * // parsed.hours === [0,1,2,...,23]\n * ```\n */\nexport function parseCron(expression: string): ParsedCron {\n  const trimmed = expression.trim();\n  if (!trimmed) {\n    throw new Error(\"Cron expression must not be empty\");\n  }\n\n  const tokens = trimmed.split(/\\s+/);\n  if (tokens.length !== 5) {\n    throw new Error(\n      `Cron expression must have exactly 5 fields, got ${tokens.length}: \"${trimmed}\"`,\n    );\n  }\n\n  return {\n    minutes: parseField(tokens[0]!, FIELD_SPECS[0]!),\n    hours: parseField(tokens[1]!, FIELD_SPECS[1]!),\n    daysOfMonth: parseField(tokens[2]!, FIELD_SPECS[2]!),\n    months: parseField(tokens[3]!, FIELD_SPECS[3]!),\n    daysOfWeek: parseField(tokens[4]!, FIELD_SPECS[4]!),\n  };\n}\n","sourceCodeStart":189,"sourceCodeEnd":225,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/server/src/services/cron.ts#L189-L225","documentation":"parseCron rejects the input because after trimming it is an empty string; a cron expression must contain five whitespace-separated fields, so there is nothing to parse.","triggerScenarios":"Thrown at server/src/services/cron.ts:207 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a non-empty cron expression."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}