chenhg5/cc-connect · error

chat_id is required

Error message

chat_id is required

What it means

HTTP 400 validation response from the relay-binding API endpoint: the chat_id query parameter is missing from the GET request, so the relay cannot look up the bot binding for the chat.

Source

Thrown at core/api.go:824

		return
	}
	if req.ChatID == "" || len(req.Bots) < 2 {
		http.Error(w, "chat_id and at least 2 bots are required", http.StatusBadRequest)
		return
	}

	s.relay.Bind(req.Platform, req.ChatID, req.Bots)
	apiJSON(w, http.StatusOK, map[string]string{"status": "ok"})
}

func (s *APIServer) handleRelayBinding(w http.ResponseWriter, r *http.Request) {
	if s.relay == nil {
		http.Error(w, "relay not available", http.StatusServiceUnavailable)
		return
	}
	chatID := r.URL.Query().Get("chat_id")
	if chatID == "" {
		http.Error(w, "chat_id is required", http.StatusBadRequest)
		return
	}
	binding := s.relay.GetBinding(chatID)
	if binding == nil {
		http.Error(w, "no binding found", http.StatusNotFound)
		return
	}
	apiJSON(w, http.StatusOK, binding)
}

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Append ?chat_id=<id> to the GET request
  2. Verify the chat id matches the one used when binding
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at core/api.go:824 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/47c9ab29c0656e74. Report an issue: GitHub.