{"record":{"id":"19c9fe810358df54","repo":"chenhg5/cc-connect","slug":"timer-scheduler-not-available","errorCode":null,"errorMessage":"timer scheduler not available","messagePattern":"timer scheduler not available","errorType":"http","errorClass":null,"httpStatus":503,"severity":"error","filePath":"core/api.go","lineNumber":734,"sourceCode":"\t\treturn\n\t}\n\n\tjob := s.timer.Store().Get(id)\n\tif job == nil {\n\t\thttp.Error(w, \"timer not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\n\tapiJSON(w, http.StatusOK, job)\n}\n\nfunc (s *APIServer) handleTimerDel(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.timer == nil {\n\t\thttp.Error(w, \"timer scheduler not available\", http.StatusServiceUnavailable)\n\t\treturn\n\t}\n\n\tvar req struct {\n\t\tID string `json:\"id\"`\n\t}\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.ID == \"\" {\n\t\thttp.Error(w, \"id is required\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tif !s.timer.RemoveJob(req.ID) {\n\t\thttp.Error(w, \"timer not found\", http.StatusNotFound)\n\t\treturn","sourceCodeStart":716,"sourceCodeEnd":752,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/core/api.go#L716-L752","documentation":"handleTimerDel requires timer scheduler support; if s.timer is nil (timer feature not configured or not wired at startup) it returns 503. The deletion endpoint cannot function without a backing scheduler.","triggerScenarios":"POST to timer-delete when the APIServer was constructed without a timer scheduler (timer feature disabled in config or not initialized).","commonSituations":"Deployments running without the timer subsystem; config.toml missing the timer section; older builds where the scheduler was optional.","solutions":["Enable/configure the timer scheduler in config.toml and restart","Check server startup logs for timer initialization errors","Skip timer API calls in clients when the timer feature is disabled, or feature-detect via a status/health endpoint"],"exampleFix":"// config.toml before\n# (no [timer] section)\n// after\n[timer]\nenabled = true","handlingStrategy":"fallback","validationCode":"const health = await (await fetch('/api/health')).json();\nif (!health.timerEnabled) console.warn('timer feature disabled; skipping timer API');","typeGuard":null,"tryCatchPattern":"try { await delTimer(id); } catch (e) { if (e.status === 503) { disableTimerUI(); return; } throw e; }","preventionTips":["Verify the [timer] section is present and enabled in config.toml before shipping deployments that use timers","Feature-detect timer availability at client startup","Check server startup logs for scheduler init failures"],"tags":["http-api","service-unavailable","timer"],"backgroundTag":"feature-not-enabled","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}