sipeed/picoclaw · error

Invalid Pico token

Error message

Invalid Pico token

What it means

Sent as a 403 by handlePicoMediaProxy when gateway.picoToken is empty: the media proxy has no Pico token to inject into upstream requests, so it refuses to proxy. Means the Pico channel is reachable but has no token configured.

Solutions

  1. Run POST /api/pico/setup or regenerate a token via the Pico token endpoint
  2. Verify the Pico channel settings in the config contain a non-empty token
  3. Retry the media request after the token is set
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at web/backend/api/pico.go:189 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15). Data as JSON: /api/errors/a7e051105c5743b5. Report an issue: GitHub.

Appendix: source

Thrown at web/backend/api/pico.go:189

		h.createWsProxy(origProtocol, upstreamProtocol).ServeHTTP(w, r)
	}
}

func (h *Handler) handlePicoMediaProxy() http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		if !h.gatewayAvailableForProxy() {
			logger.Warnf("Gateway not available for Pico media proxy")
			http.Error(w, "Gateway not available", http.StatusServiceUnavailable)
			return
		}

		gateway.mu.Lock()
		picoToken := gateway.picoToken
		gateway.mu.Unlock()

		if picoToken == "" {
			logger.Warnf("Missing Pico token for media proxy")
			http.Error(w, "Invalid Pico token", http.StatusForbidden)
			return
		}

		h.createPicoHTTPProxy(picoToken).ServeHTTP(w, r)
	}
}

// handleGetPicoInfo returns non-secret Pico connection info for the launcher UI.
//
//	GET /api/pico/info
func (h *Handler) handleGetPicoInfo(w http.ResponseWriter, r *http.Request) {
	cfg, err := config.LoadConfig(h.configPath)
	if err != nil {
		http.Error(w, fmt.Sprintf("Failed to load config: %v", err), http.StatusInternalServerError)
		return
	}

	h.writePicoInfoResponse(w, r, cfg, nil)

View on GitHub (pinned to 49183d7e8d)