← tutte le chat Cowork
2026-07-21 aggiornare-openclaw-e-fix-401
cowork0 messaggi
2026-07-21 — Aggiornare OpenClaw + fix "401 Invalid authentication credentials"
MESSAGGI UTENTE (in ordine)
- > aiutami ad aggiornare openclaw
- > dammi tutti i comandi
- > okay, fatto tutto, ma ho mandato un messaggio e ho ricevuto: Error: Failed to authenticate. API Error: 401 Invalid authentication credentials
- > [claude -p → 401; claude → apre Claude Code]
- > [ANTHROPIC_API_KEY = [] ; CLAUDE_CODE_OAUTH_TOKEN = []]
- > Fatto!! Grazie mille
PERCORSO / DIAGNOSI
- Versione installata 2026.7.1; ultima su npm (latest) = 2026.7.1-2 (patch piccola). Procedura update collaudata: update --dry-run → update → doctor --lint/--fix → gateway restart → status/health.
- Dopo l'update: l'agente rispondeva 401 Invalid authentication credentials all'invio di un messaggio.
- Controllo config (openclaw.json): segreti migrati oggi nel filevault (secrets/openclaw-secrets.json) con chiavi prefissate "S" (Stoken/SbotToken/SapiKey) — COERENTI tra config e vault ⇒ non è quello il problema.
- Il cervello usa
agentRuntime: claude-cli(Claude via Max). Test:claude -p "OK"→ 401, maclaudeinterattivo → funziona. ⇒ problema della modalità programmatica -p, non del login. - Env vuote:
ANTHROPIC_API_KEY = [],CLAUDE_CODE_OAUTH_TOKEN = []. - Causa: in
-pheadless il login Max salvato non viene agganciato in modo affidabile (ordine credenziali Claude Code: ANTHROPIC_API_KEY > apiKeyHelper > CLAUDE_CODE_OAUTH_TOKEN > /login).
FIX APPLICATO (RISOLTO)
claude setup-token→ token a lunga durata dell'abbonamento (sk-ant-oat01-...)setx CLAUDE_CODE_OAUTH_TOKEN "<token>"- Riaprire PowerShell →
claude -p "OK"funziona schtasks /end /tn "OpenClaw Gateway"+schtasks /run /tn "OpenClaw Gateway"→openclaw status→ Agente di nuovo operativo.
DA RICORDARE
- Il token setup-token SCADE: il 401 ricapiterà → rifare
claude setup-token+ setx. - Prima diagnosi al prossimo 401: testa
claude -p, poi controlla le 2 env, poi applica il fix del caso (rimuovi ANTHROPIC_API_KEY se presente / genera CLAUDE_CODE_OAUTH_TOKEN se vuoto). - Memoria aggiornata: openclaw-claude-cli-401.md + indice.
FONTI
- code.claude.com/docs/en/errors (ordine credenziali / headless)
- github.com/anthropics/claude-code issues #43333, #5666