Skip to content

ReferenceError: Cannot access 'ANTHROPIC_MODEL_ALIASES' before initialization when reading config #45368

@iamade

Description

@iamade

Bug type

Regression (worked before, now fails)

Summary

Running OpenClaw CLI commands that load config prints:
Failed to read config ... ReferenceError: Cannot access 'ANTHROPIC_MODEL_ALIASES' before initialization.
Gateway continues running, but CLI reports config-read failure.

Environment
OpenClaw: 2026.3.12 (6472949)
OS: macOS 26.3.1 (arm64)
Node: 24.13.0 (nvm)
Install: stable (npm global), LaunchAgent running
Config path: ~/.openclaw/openclaw.json

Steps to reproduce

  1. Install OpenClaw 2026.3.12 on macOS (arm64) with Node 24.13.0
  2. Ensure gateway is running (LaunchAgent).
  3. Run: openclaw status --all(Also happens with: openclaw gateway status, openclaw plugins list)

Expected behavior

CLI reads ~/.openclaw/openclaw.json without throwing and prints status normally (no config-read error).

Actual behavior

CLI prints:
Failed to read config ... ReferenceError: Cannot access 'ANTHROPIC_MODEL_ALIASES' before initialization
and continues in “best-effort config” mode / partial output.

OpenClaw version

OpenClaw: 2026.3.12 (6472949)

Operating system

OS: macOS 26.3.1 (arm64)

Install method

Install: stable (npm global), LaunchAgent running

Model

anthropic/claude-4.6

Provider / routing chain

anthropic -> claude- opus-4.6

Config file / key location

Config path: ~/.openclaw/openclaw.json

Additional provider/model setup details

~ grep -n "anthropic" ~/.openclaw/openclaw.json
14: "anthropic:anthropi-openclaw": {
15: "provider": "anthropic",
18: "anthropic:direct-api-key": {
19: "provider": "anthropic",
36: "anthropic": [
37: "anthropic:direct-api-key",
38: "anthropic:anthropi-openclaw"
63: "primary": "anthropic/claude-opus-4-6",
65: "anthropic/claude-opus-4-5-20250918",
66: "anthropic/claude-sonnet-4-6",
69: "openrouter/anthropic/claude-4.6-opus"
73: "anthropic/claude-opus-4-6": {
78: "anthropic/claude-opus-4-5-20250918": {
84: "openrouter/anthropic/claude-4.6-opus": {},
85: "openrouter/anthropic/claude-opus-4.5": {},
87: "anthropic/claude-sonnet-4-6": {
102: "anthropic/openai-codex": {
135: "primary": "anthropic/claude-sonnet-4-6",
149: "primary": "anthropic/claude-opus-4-6",
162: "primary": "anthropic/claude-opus-4-6",
174: "primary": "anthropic/claude-sonnet-4-6"

Logs, screenshots, and evidence

~ openclaw status --all
[openclaw] Failed to read config at /Users/[REDACTED]/.openclaw/openclaw.json ReferenceError: Cannot access 'ANTHROPIC_MODEL_ALIASES' before initialization
    at normalizeAnthropicModelId (...)
    [... stack trace truncated ...]

🦞 OpenClaw 2026.3.12 (6472949)
   Your second brain, except this one actually remembers where you left things.

Overview
Version    : 2026.3.12 (macos arm64, Node 24.13.0)
Config     : ~/.openclaw/openclaw.json
Gateway    : local · ws://127.0.0.1:18789 (local loopback) · reachable
Service    : LaunchAgent installed · loaded · running (pid 9021)
Agents     : 5 total · 1 active (main, 1h ago) · 41 sessions

Channels
Telegram   : ON | OK | token env
WhatsApp   : ON | OK | linked: +[REDACTED] | allow: +[REDACTED]
Discord    : ON | OK | accounts: cos (@PP Chief of Staff), default (@oluwa_tobi_cl)

Diagnosis
! Port 18789 is already in use by pid 9021 (openclaw-gateway)
! Tailscale: error: spawn tailscale ENOENT

Gateway logs (stderr summary)
  [diagnostic] lane task error: durationMs=602027 error="FailoverError: LLM request timed out."
  [model-fallback/decision] model fallback decision: decision=candidate_failed requested=ollama/qwen3.5:9b candidate=ollama/qwen3.5:9b reason=unknown next=google/gemini-3.1-flash-lite-preview
  [whatsapp] Web connection closed (status 408). Retry 1/12 in 2.47s… (status=408 Request Time-out)
  [model-fallback/decision] model fallback decision: decision=candidate_succeeded requested=ollama/qwen3.5:9b candidate=google/gemini-3.1-flash-lite-preview reason=unknown next=none
  Failed to read config at /Users/[REDACTED]/.openclaw/openclaw.json ReferenceError: Cannot access 'ANTHROPIC_MODEL_ALIASES' before initialization
  [plugins] acpx local binary unavailable or mismatched... running plugin-local install

Gateway logs (stdout summary)
  [gateway] received SIGTERM; shutting down
  [ws] webchat disconnected code=1012 reason=service restart
  [telegram] [default] starting provider (@Ades_Tob_bot)
  [discord] logged in to discord as PP Chiaff
  [whatsapp] Listening for personal WhatsApp inbound messages.
  [discord] logged in to discord as oluwa_tobi_cl
  [plugins] acpx plugin-local binary ready (version 0.1.16)
  [plugins] acpx runtime backend ready


~ grep -n "anthropic" ~/.openclaw/openclaw.json
14:      "anthropic:anthropi-openclaw": {
15:        "provider": "anthropic",
18:      "anthropic:direct-api-key": {
19:        "provider": "anthropic",
36:      "anthropic": [
37:        "anthropic:direct-api-key",
38:        "anthropic:anthropi-openclaw"
63:        "primary": "anthropic/claude-opus-4-6",
65:          "anthropic/claude-opus-4-5-20250918",
66:          "anthropic/claude-sonnet-4-6",
69:          "openrouter/anthropic/claude-4.6-opus"
73:        "anthropic/claude-opus-4-6": {
78:        "anthropic/claude-opus-4-5-20250918": {
84:        "openrouter/anthropic/claude-4.6-opus": {},
85:        "openrouter/anthropic/claude-opus-4.5": {},
87:        "anthropic/claude-sonnet-4-6": {
102:        "anthropic/openai-codex": {
135:          "primary": "anthropic/claude-sonnet-4-6",
149:          "primary": "anthropic/claude-opus-4-6",
162:          "primary": "anthropic/claude-opus-4-6",
174:          "primary": "anthropic/claude-sonnet-4-6"

Impact and severity

No response

Additional information

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingclose:already-fixedclaw-marshal labelclose:duplicateClosed as duplicatededupe:childDuplicate issue/PR child in dedupe clusterregressionBehavior that previously worked and now fails

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions