{"record":{"id":"fceddd11f5059b40","repo":"chenhg5/cc-connect","slug":"to-session-key-and-message-are-required","errorCode":null,"errorMessage":"to, session_key, and message are required","messagePattern":"to, session_key, and message are required","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"core/api.go","lineNumber":776,"sourceCode":"// ── Relay API ──────────────────────────────────────────────────\n\nfunc (s *APIServer) handleRelaySend(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != http.MethodPost {\n\t\thttp.Error(w, \"POST only\", http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\tif s.relay == nil {\n\t\thttp.Error(w, \"relay not available\", http.StatusServiceUnavailable)\n\t\treturn\n\t}\n\n\tvar req RelayRequest\n\tif err := json.NewDecoder(r.Body).Decode(&req); err != nil {\n\t\thttp.Error(w, \"invalid JSON: \"+err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tif req.To == \"\" || req.Message == \"\" || req.SessionKey == \"\" {\n\t\thttp.Error(w, \"to, session_key, and message are required\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tresp, err := s.relay.Send(r.Context(), req)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tapiJSON(w, http.StatusOK, resp)\n}\n\nfunc (s *APIServer) handleRelayBind(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != http.MethodPost {\n\t\thttp.Error(w, \"POST only\", http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\tif s.relay == nil {","sourceCodeStart":758,"sourceCodeEnd":794,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/core/api.go#L758-L794","documentation":"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.","triggerScenarios":"Thrown at core/api.go:776 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Populate all required fields — to, session_key, and message — in the relay request JSON","Validate the request client-side before posting"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}