chenhg5/cc-connect · error

cron scheduler not available

Error message

cron scheduler not available

What it means

handleCronAdd rejected the request because the API server was constructed without a cron scheduler (s.cron == nil) — cron functionality is not wired into this deployment, so no cron jobs can be created via the API.

Source

Thrown at core/api.go:337

	SessionKey  string `json:"session_key"`
	CronExpr    string `json:"cron_expr"`
	Prompt      string `json:"prompt"`
	Exec        string `json:"exec"`
	WorkDir     string `json:"work_dir"`
	Description string `json:"description"`
	Silent      *bool  `json:"silent,omitempty"`
	SessionMode string `json:"session_mode,omitempty"`
	Mode        string `json:"mode,omitempty"`
	TimeoutMins *int   `json:"timeout_mins,omitempty"`
}

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

	var req CronAddRequest
	if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
		http.Error(w, "invalid JSON: "+err.Error(), http.StatusBadRequest)
		return
	}
	if req.CronExpr == "" {
		http.Error(w, "cron_expr is required", http.StatusBadRequest)
		return
	}
	if req.Prompt == "" && req.Exec == "" {
		http.Error(w, "either prompt or exec is required", http.StatusBadRequest)
		return
	}
	if req.Prompt != "" && req.Exec != "" {
		http.Error(w, "prompt and exec are mutually exclusive", http.StatusBadRequest)

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Enable the cron scheduler in the server/engine wiring before exposing the cron API
  2. Return 503 to clients and document that cron is disabled in this build
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at core/api.go:337 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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