{"record":{"id":"9ebbe78121bfce0e","repo":"sipeed/picoclaw","slug":"pico-channel-not-configured","errorCode":null,"errorMessage":"Pico channel not configured","messagePattern":"Pico channel not configured","errorType":"http","errorClass":null,"httpStatus":503,"severity":"error","filePath":"web/backend/api/pico.go","lineNumber":162,"sourceCode":"\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t_ = json.NewEncoder(w).Encode(resp)\n}\n\n// handleWebSocketProxy wraps a reverse proxy to handle WebSocket connections.\n// It relies on launcher dashboard auth, then injects the raw pico token only\n// on the upstream gateway request.\nfunc (h *Handler) handleWebSocketProxy() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tif !h.gatewayAvailableForProxy() {\n\t\t\tlogger.Warnf(\"Gateway not available for WebSocket proxy\")\n\t\t\thttp.Error(w, \"Gateway not available\", http.StatusServiceUnavailable)\n\t\t\treturn\n\t\t}\n\n\t\tupstreamProtocol := picoGatewayProtocol()\n\t\tif upstreamProtocol == \"\" {\n\t\t\tlogger.Warn(\"Pico token unavailable for WebSocket proxy\")\n\t\t\thttp.Error(w, \"Pico channel not configured\", http.StatusServiceUnavailable)\n\t\t\treturn\n\t\t}\n\n\t\tvar origProtocol string\n\t\tif prot := r.Header.Values(protocolKey); len(prot) > 0 {\n\t\t\torigProtocol = prot[0]\n\t\t}\n\n\t\th.createWsProxy(origProtocol, upstreamProtocol).ServeHTTP(w, r)\n\t}\n}\n\nfunc (h *Handler) handlePicoMediaProxy() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tif !h.gatewayAvailableForProxy() {\n\t\t\tlogger.Warnf(\"Gateway not available for Pico media proxy\")\n\t\t\thttp.Error(w, \"Gateway not available\", http.StatusServiceUnavailable)\n\t\t\treturn","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/web/backend/api/pico.go#L144-L180","documentation":"Sent by handleWebSocketProxy when the Pico channel has no token configured, so the proxy cannot inject credentials on the upstream gateway request and refuses to forward the WebSocket. Generic guard on the missing-token precondition.","triggerScenarios":"Thrown at web/backend/api/pico.go:162 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run POST /api/pico/setup or regenerate a token to configure the Pico channel","Verify the Pico channel settings in the config contain a non-empty token","Retry the WebSocket connection after the token is set"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","contentChangedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}