{"record":{"id":"22daec0e84606897","repo":"sipeed/picoclaw","slug":"gateway-not-available","errorCode":null,"errorMessage":"Gateway not available","messagePattern":"Gateway not available","errorType":"http","errorClass":null,"httpStatus":503,"severity":"error","filePath":"web/backend/api/pico.go","lineNumber":155,"sourceCode":"\tif changed != nil {\n\t\tresp[\"changed\"] = *changed\n\t}\n\tif picoCfg.Token.String() != \"\" {\n\t\tresp[\"configured\"] = true\n\t}\n\n\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}","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/web/backend/api/pico.go#L137-L173","documentation":"Error \"Gateway not available\" thrown in sipeed/picoclaw.","triggerScenarios":"Thrown at web/backend/api/pico.go:155 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}