sipeed/picoclaw · error
unsupported provider %q
Error message
unsupported provider %q
What it means
Returned as HTTP 400 by POST /api/oauth/login when normalizeOAuthProvider rejects the "provider" field. The backend only knows three providers: "openai", "anthropic", and "google-antigravity" (the alias "antigravity" is also accepted and canonicalized). Any other value is echoed back quoted, e.g. unsupported provider "open AI". The value is lowercased and trimmed before matching, so only spelling variants of those three names pass.
Source
Thrown at web/backend/api/oauth.go:193
if err != nil {
http.Error(w, "failed to read request body", http.StatusBadRequest)
return
}
defer r.Body.Close()
var req struct {
Provider string `json:"provider"`
Method string `json:"method"`
Token string `json:"token"`
}
if err = json.Unmarshal(body, &req); err != nil {
http.Error(w, fmt.Sprintf("invalid JSON: %v", err), http.StatusBadRequest)
return
}
provider, err := normalizeOAuthProvider(req.Provider)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
method := strings.ToLower(strings.TrimSpace(req.Method))
if !isOAuthMethodSupported(provider, method) {
http.Error(
w,
fmt.Sprintf("unsupported login method %q for provider %q", method, provider),
http.StatusBadRequest,
)
return
}
switch method {
case oauthMethodToken:
token := strings.TrimSpace(req.Token)
if token == "" {
http.Error(w, "token is required", http.StatusBadRequest)View on GitHub (pinned to 49183d7e8d)
Solutions
- Use exactly one of: "openai", "anthropic", "google-antigravity" (alias "antigravity" also works) in the provider field.
- Fetch GET /api/oauth/providers and drive your UI from the returned provider list instead of hardcoding names.
- If you need a provider not in that list, upgrade picoclaw — new providers are added to oauthProviderOrder/normalizeOAuthProvider, not via config.
- Check for invisible whitespace or unicode look-alike characters if a name that looks correct still fails (trim/lowercase is applied, but homoglyphs are not).
Example fix
// before (curl)
curl -X POST http://localhost:8080/api/oauth/login \
-d '{"provider":"open-ai","method":"token","token":"sk-..."}'
// -> 400 unsupported provider "open-ai"
// after
curl -X POST http://localhost:8080/api/oauth/login \
-H 'Content-Type: application/json' \
-d '{"provider":"openai","method":"token","token":"sk-..."}' Defensive patterns
Strategy: validation
Validate before calling
const SUPPORTED = new Set(['openai', 'anthropic', 'google-antigravity', 'antigravity']);
function assertProvider(provider) {
const p = String(provider ?? '').trim().toLowerCase();
if (!SUPPORTED.has(p)) throw new Error(`unsupported provider ${JSON.stringify(provider)}`);
return p === 'antigravity' ? 'google-antigravity' : p;
} Type guard
function isOAuthProvider(v) {
return ['openai', 'anthropic', 'google-antigravity'].includes(String(v ?? '').trim().toLowerCase());
} Prevention
- Source the provider list from GET /api/oauth/providers instead of hardcoding or reusing model-config provider names.
- Normalize provider strings (trim + lowercase) before sending.
- Remember the alias: 'antigravity' is accepted and mapped to 'google-antigravity'.
When it happens
Trigger: POST /api/oauth/login with body {"provider":"azure","method":"token","token":"sk-..."} or any typo like "OpenAI " (spaces are fine, but "open-ai" is not). Also triggered by sending a provider name that exists in the gateway config (e.g. "gemini") but has no OAuth entry in the oauthProviderMethods map.
Common situations: Copy-pasting provider names from the model config (which uses names like "antigravity") instead of the OAuth provider list; running an older build that predates google-antigravity support; frontend dropdowns that list every configured model provider rather than only the three OAuth-capable ones.
Related errors
- unsupported login method %q for provider %q
- token is required
- missing flow id
- no refresh token available
- Model %q cannot be used as the default chat model
AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15).
Data as JSON: /api/errors/907e155bd7cfceee.
Report an issue: GitHub.