chenhg5/cc-connect · error

id is required

Error message

id is required

What it means

HTTP 400 validation response from the timer-info API endpoint: the `id` query parameter is missing from the GET request, so the timer store cannot be looked up.

Source

Thrown at core/api.go:715

		}
	}

	apiJSON(w, http.StatusOK, pending)
}

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

	id := r.URL.Query().Get("id")
	if id == "" {
		http.Error(w, "id is required", http.StatusBadRequest)
		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 {

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Append ?id=<timer-job-id> to the request URL
  2. Verify the id variable in the calling code is non-empty before issuing the request
  3. Use the id returned when the timer job was created (e.g. from the timer-add response)

Example fix

// before
GET /api/timer/info
// after
GET /api/timer/info?id=abc123
Defensive patterns

Strategy: validation

Validate before calling

if (!id) throw new Error('timer id is required');
const res = await fetch(`/api/timer/info?id=${encodeURIComponent(id)}`);

Type guard

function hasTimerId(q) { return typeof q?.id === 'string' && q.id.trim().length > 0; }

Prevention

When it happens

Trigger: Request to the timer-info endpoint without an id query parameter, or with id= empty (e.g. ?id=).

Common situations: URL built by string concatenation where the id variable was empty; missing encodeURIComponent on a template; querying info before creating any timer.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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