chenhg5/cc-connect · error

to, session_key, and message are required

Error message

to, session_key, and message are required

What it means

handleRelaySend validated the decoded RelayRequest and found one of the mandatory fields empty: to (target platform), session_key (which session sends), or message (content). The relay cannot route a send missing any of them.

Source

Thrown at core/api.go:776

// ── Relay API ──────────────────────────────────────────────────

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

	var req RelayRequest
	if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
		http.Error(w, "invalid JSON: "+err.Error(), http.StatusBadRequest)
		return
	}
	if req.To == "" || req.Message == "" || req.SessionKey == "" {
		http.Error(w, "to, session_key, and message are required", http.StatusBadRequest)
		return
	}

	resp, err := s.relay.Send(r.Context(), req)
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}

	apiJSON(w, http.StatusOK, resp)
}

func (s *APIServer) handleRelayBind(w http.ResponseWriter, r *http.Request) {
	if r.Method != http.MethodPost {
		http.Error(w, "POST only", http.StatusMethodNotAllowed)
		return
	}
	if s.relay == nil {

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Populate all required fields — to, session_key, and message — in the relay request JSON
  2. Validate the request client-side before posting
Defensive patterns

Strategy: validation

When it happens

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