-
-
Notifications
You must be signed in to change notification settings - Fork 69.5k
Grok model crashes with undefined.includes() error after Anthropic credit failure #12165
Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
Labels
bugSomething isn't workingSomething isn't workingstaleMarked as stale due to inactivityMarked as stale due to inactivity
Description
Grok model crashes with "Cannot read properties of undefined (reading 'includes')"
Issue
After Anthropic API credits ran out, switching to Grok (xai/grok-4-1-fast-reasoning) now consistently throws a JavaScript error:
Cannot read properties of undefined (reading 'includes')
Timeline
- Anthropic credits expired → started getting similar undefined errors
- Switched to Grok → same "undefined.includes()" error appears
- Gateway restart → error persists
- Removed compat flags from Grok config → error persists
- Sonnet/Haiku work fine → no errors
Evidence
- Sonnet (anthropic/claude-sonnet-4-5): ✅ Works perfectly
- Haiku (anthropic/claude-3-5-haiku-latest): ✅ Works in cron jobs
- Grok reasoning (xai/grok-4-1-fast-reasoning): ❌ Crashes with undefined error
- Grok non-reasoning (xai/grok-4-1-fast-non-reasoning): ❌ Crashes in cron jobs
Root Cause Hypothesis
The Anthropic credit failure corrupted some internal model resolution state. Even after:
- Refilling Anthropic credits
- Restarting gateway multiple times
- Removing Grok's
compatflags (supportsDeveloperRole,supportsReasoningEffort)
The error persists when using ANY xAI model.
Gateway Logs
2026-02-08T22:15:50.007Z [agent:nested] session=agent:main:cron:23b5f86d-39e7-4236-979d-63e0592fe347 run=b232226c-1b3f-48bd-87a3-c9ab0b55aede channel=webchat Cannot read properties of undefined (reading 'includes')
Error appears in:
- Main chat session when switching to Grok
- Cron job isolated sessions using Grok non-reasoning
Config (Grok section)
"xai": {
"baseUrl": "https://api.x.ai/v1",
"apiKey": "XAI_API_KEY",
"api": "openai-completions",
"models": [
{
"id": "grok-4-1-fast-reasoning",
"name": "Grok 4.1 Fast (Reasoning)",
"api": "openai-completions",
"reasoning": true,
"input": ["text"],
"cost": {
"input": 0.2,
"output": 0.5,
"cacheRead": 0.05,
"cacheWrite": 0.2
},
"contextWindow": 2000000,
"maxTokens": 8192
}
]
}Environment
- Clawdbot version: 2026.1.24-3 (885167d)
- OS: macOS (arm64)
- Node: v25.5.0
- Auth: xai:manual token mode
Workaround
Switched to Sonnet as default, but this is burning credits faster. Grok is 15x cheaper ($0.20/$0.50 vs $3/$15 per M tokens).
Request
- Fix the undefined
.includes()error when using xAI models - Add better error handling/logging so we can see WHAT is undefined
- Ensure provider errors don't corrupt model resolution state
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingstaleMarked as stale due to inactivityMarked as stale due to inactivity
Type
Fields
Give feedbackNo fields configured for issues without a type.