Bug type
Behavior bug (incorrect output/state without crash)
Summary
OpenClaw Gateway fails to start with ReferenceError: Cannot access 'ANTHROPIC_MODEL_ALIASES' before initialization when agents.defaults.model is configured as an object (with primary key).
Steps to reproduce
// ~/.openclaw/openclaw.json
{
"agents": {
"defaults": {
"model": {
"primary": "anthropic/claude-haiku-4-5"
}
}
},
"gateway": {
"mode": "local",
"port": 3210
},
"channels": {
"telegram": {
"enabled": false
}
},
"tools": {
"elevated": {
"enabled": true
}
}
}
Expected behavior
Gateway should successfully start with object-style model configuration as documented.
According to the official documentation, agents.defaults.model should accept both formats:
String (simple): "anthropic/claude-haiku-4-5"
Object (with fallbacks):
{
"primary": "anthropic/claude-haiku-4-5",
"fallbacks": ["openai/gpt-5.2"]
}
Actual behavior
Service fails immediately on start:
$ sudo systemctl status openclaw-gateway.service
● openclaw-gateway.service - OpenClaw Gateway (Swarm Master)
Loaded: loaded (/etc/systemd/system/openclaw-gateway.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2026-03-13 17:XX:XX UTC; 2s ago
Process: XXXXX ExecStart=/home/openclaw/.npm-global/bin/openclaw gateway (code=exited, status=1/FAILURE)
Main PID: XXXXX (code=exited, status=1/FAILURE)
OpenClaw version
2026.3.12
Operating system
Ubuntu 22.04 LTS
Install method
npm global install
Model
claude-haiku-4-5
Provider / routing chain
Local OpenClaw Gateway → Anthropic (direct)
Config file / key location
No response
Additional provider/model setup details
ocal Gateway → Anthropic Provider (direct API)
Details:
- Gateway mode: "local" (localhost:3210)
- Target provider: Anthropic (claude-haiku-4-5)
- No proxies or model routers involved
- Error occurs during config parsing (before any API requests)
- Config loader → normalizeAnthropicModelId() → ReferenceError
The bug prevents gateway startup, so no actual provider routing happens.
Error is in config initialization, not in request routing.
Logs, screenshots, and evidence
ReferenceError: Cannot access 'ANTHROPIC_MODEL_ALIASES' before initialization
at normalizeAnthropicModelId (file:///home/openclaw/.npm-global/lib/node_modules/openclaw/dist/auth-profiles-iXW75sRj.js:163883:2)
at file:///home/openclaw/.npm-global/lib/node_modules/openclaw/dist/auth-profiles-iXW75sRj.js:163769:21
at Array.map (<anonymous>)
at Object.loadConfigSnapshot (file:///home/openclaw/.npm-global/lib/node_modules/openclaw/dist/auth-profiles-iXW75sRj.js:163755:61)
Impact and severity
No response
Additional information
Ensure ANTHROPIC_MODEL_ALIASES is defined before any code path that calls normalizeAnthropicModelId() during config parsing.
Bug type
Behavior bug (incorrect output/state without crash)
Summary
OpenClaw Gateway fails to start with ReferenceError: Cannot access 'ANTHROPIC_MODEL_ALIASES' before initialization when agents.defaults.model is configured as an object (with primary key).
Steps to reproduce
// ~/.openclaw/openclaw.json
{
"agents": {
"defaults": {
"model": {
"primary": "anthropic/claude-haiku-4-5"
}
}
},
"gateway": {
"mode": "local",
"port": 3210
},
"channels": {
"telegram": {
"enabled": false
}
},
"tools": {
"elevated": {
"enabled": true
}
}
}
Expected behavior
Gateway should successfully start with object-style model configuration as documented.
According to the official documentation, agents.defaults.model should accept both formats:
String (simple): "anthropic/claude-haiku-4-5"
Object (with fallbacks):
{
"primary": "anthropic/claude-haiku-4-5",
"fallbacks": ["openai/gpt-5.2"]
}
Actual behavior
Service fails immediately on start:
$ sudo systemctl status openclaw-gateway.service
● openclaw-gateway.service - OpenClaw Gateway (Swarm Master)
Loaded: loaded (/etc/systemd/system/openclaw-gateway.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2026-03-13 17:XX:XX UTC; 2s ago
Process: XXXXX ExecStart=/home/openclaw/.npm-global/bin/openclaw gateway (code=exited, status=1/FAILURE)
Main PID: XXXXX (code=exited, status=1/FAILURE)
OpenClaw version
2026.3.12
Operating system
Ubuntu 22.04 LTS
Install method
npm global install
Model
claude-haiku-4-5
Provider / routing chain
Local OpenClaw Gateway → Anthropic (direct)
Config file / key location
No response
Additional provider/model setup details
ocal Gateway → Anthropic Provider (direct API)
Details:
The bug prevents gateway startup, so no actual provider routing happens.
Error is in config initialization, not in request routing.
Logs, screenshots, and evidence
Impact and severity
No response
Additional information
Ensure ANTHROPIC_MODEL_ALIASES is defined before any code path that calls normalizeAnthropicModelId() during config parsing.