chenhg5/cc-connect · error
chat_id and at least 2 bots are required
Error message
chat_id and at least 2 bots are required
What it means
handleRelayBind validated the bind request and rejected it: chat_id is empty or fewer than 2 bots were supplied — a relay binding is only meaningful when a chat has at least two bot identities to alternate between.
Source
Thrown at core/api.go:809
http.Error(w, "POST only", http.StatusMethodNotAllowed)
return
}
if s.relay == nil {
http.Error(w, "relay not available", http.StatusServiceUnavailable)
return
}
var req struct {
Platform string `json:"platform"`
ChatID string `json:"chat_id"`
Bots map[string]string `json:"bots"`
}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
http.Error(w, "invalid JSON: "+err.Error(), http.StatusBadRequest)
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)View on GitHub (pinned to 4000b2338a)
Solutions
- Provide a non-empty chat_id and at least two entries in the bots map
- Ensure each bot entry maps a bot identity to its session/key as the relay expects
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at core/api.go:809 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/0d45ffb7466f10c7.
Report an issue: GitHub.