{"record":{"id":"43fe596d93bcda8d","repo":"chenhg5/cc-connect","slug":"cron-expr-is-required","errorCode":null,"errorMessage":"cron_expr is required","messagePattern":"cron_expr is required","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"core/api.go","lineNumber":347,"sourceCode":"}\n\nfunc (s *APIServer) handleCronAdd(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != http.MethodPost {\n\t\thttp.Error(w, \"POST only\", http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\tif s.cron == nil {\n\t\thttp.Error(w, \"cron scheduler not available\", http.StatusServiceUnavailable)\n\t\treturn\n\t}\n\n\tvar req CronAddRequest\n\tif err := json.NewDecoder(r.Body).Decode(&req); err != nil {\n\t\thttp.Error(w, \"invalid JSON: \"+err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tif req.CronExpr == \"\" {\n\t\thttp.Error(w, \"cron_expr is required\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tif req.Prompt == \"\" && req.Exec == \"\" {\n\t\thttp.Error(w, \"either prompt or exec is required\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tif req.Prompt != \"\" && req.Exec != \"\" {\n\t\thttp.Error(w, \"prompt and exec are mutually exclusive\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Resolve project: use provided, or pick single engine\n\tproject := req.Project\n\tif project == \"\" {\n\t\ts.mu.RLock()\n\t\tif len(s.engines) == 1 {\n\t\t\tfor name := range s.engines {\n\t\t\t\tproject = name","sourceCodeStart":329,"sourceCodeEnd":365,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/core/api.go#L329-L365","documentation":"HTTP 400 validation response from the cron-add API endpoint: the decoded CronAddRequest JSON has an empty cron_expr field, so the scheduler has no schedule expression to register the job with.","triggerScenarios":"Thrown at core/api.go:347 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Include a valid cron_expr (e.g. \"0 9 * * *\") in the request body","Validate the expression syntax client-side before sending"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}