chenhg5/cc-connect · error

timer scheduler not available

Error message

timer scheduler not available

What it means

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.

Source

Thrown at core/api.go:734

		return
	}

	job := s.timer.Store().Get(id)
	if job == nil {
		http.Error(w, "timer not found", http.StatusNotFound)
		return
	}

	apiJSON(w, http.StatusOK, job)
}

func (s *APIServer) handleTimerDel(w http.ResponseWriter, r *http.Request) {
	if r.Method != http.MethodPost {
		http.Error(w, "POST only", http.StatusMethodNotAllowed)
		return
	}
	if s.timer == nil {
		http.Error(w, "timer scheduler not available", http.StatusServiceUnavailable)
		return
	}

	var req struct {
		ID string `json:"id"`
	}
	if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
		http.Error(w, "invalid JSON: "+err.Error(), http.StatusBadRequest)
		return
	}
	if req.ID == "" {
		http.Error(w, "id is required", http.StatusBadRequest)
		return
	}

	if !s.timer.RemoveJob(req.ID) {
		http.Error(w, "timer not found", http.StatusNotFound)
		return

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Enable/configure the timer scheduler in config.toml and restart
  2. Check server startup logs for timer initialization errors
  3. Skip timer API calls in clients when the timer feature is disabled, or feature-detect via a status/health endpoint

Example fix

// config.toml before
# (no [timer] section)
// after
[timer]
enabled = true
Defensive patterns

Strategy: fallback

Validate before calling

const health = await (await fetch('/api/health')).json();
if (!health.timerEnabled) console.warn('timer feature disabled; skipping timer API');

Try / catch

try { await delTimer(id); } catch (e) { if (e.status === 503) { disableTimerUI(); return; } throw e; }

Prevention

When it happens

Trigger: POST to timer-delete when the APIServer was constructed without a timer scheduler (timer feature disabled in config or not initialized).

Common situations: Deployments running without the timer subsystem; config.toml missing the timer section; older builds where the scheduler was optional.

Related errors


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/19c9fe810358df54. Report an issue: GitHub.