The Error
If you're seeing this error in your OpenClaw logs, you're not alone:
This error stops OpenClaw dead in its tracks. The agent crashes before it can even respond to your message. Frustrating? Absolutely. But the fix is straightforward once you understand what's happening.
Understanding the Root Cause
OpenClaw fails hard if the model ID is not valid for the provider. Unlike some systems that gracefully fall back to a default, OpenClaw requires exact, versioned model identifiers.
๐ Common Mistakes
- Using aliases like
claude-3.5-sonnetinstead of the full versioned ID - Using non-existent IDs like
claude-sonnet-4(without the version suffix) - Copying model names from ChatGPT interfaces that don't match API identifiers
- If you use Anthropic direct, you must use fully versioned model IDs
GitHub Context
This is a known issue in the OpenClaw community:
- Issue #4179: "Model selection lacks validation - allows non-existent models causing agent crashes"
- Discussion #5991: Multiple users reporting the exact same error with various model aliases
The maintainers are aware of the validation gap, but until it's fixed upstream, you need to manually ensure your config uses valid IDs.
Step-by-Step Fix
1Locate the Config File
OpenClaw stores its configuration at a default path:
Verify the file exists:
You should see output confirming the file exists. If not, OpenClaw may not be properly initialized.
2Correct the Model Configuration
Open the config file for editing:
Find the agents.defaults.model section and update it to use a valid versioned Anthropic model ID:
โ Valid Example (Sonnet, Recommended)
โ Valid Example (Opus, Highest Quality)
After editing, save the file:
- Press
CTRL + Oto write the file - Press
Enterto confirm - Press
CTRL + Xto exit nano
3(Optional) Allow Multiple Models
If you want to dynamically switch between models, you can configure an allowlist:
This is optional. If you're only using one model, skip this step.
4Safely Stop OpenClaw
Here's the tricky part: OpenClaw runs as a parent process with child gateway processes. If you only kill one PID, the parent respawns the child. You need to kill the parent first.
โ ๏ธ Important: Kill the Parent Process
Killing only the child process will cause it to respawn immediately. Always target the parent first.
Find all running OpenClaw processes:
You'll see output like:
root 12346 0.3 1.8 openclaw-gateway
Identify the parent PID:
The PPID column shows the parent process ID.
Stop the parent process:
sleep 2
kill -KILL <PPID>
Clean up any remaining children:
Confirm OpenClaw is fully stopped:
You should see "fully stopped" if no processes remain.
5Restart OpenClaw
Start OpenClaw again with your normal command:
(Or whatever command you typically use to start OpenClaw.)
6Verify Model Loaded
Check that the correct model is now loaded:
Expected output:
If you see your configured model ID, you're good to go!
7Confirm Error Is Gone
Monitor the logs in real-time:
You should not see the Unknown model error anymore. Test by sending a message to your agent.
8If Error Returns
If the error reappears after following all steps, check for environment variable overrides:
If you see any variables setting model IDs (like ANTHROPIC_MODEL), they might be overriding your config. Unset them or correct their values.
Summary
๐ Key Takeaways
- Only one config location is required:
/root/.openclaw/openclaw.json - Use versioned Anthropic IDs, not aliases like
claude-3.5-sonnet - Kill the parent process to prevent respawn when stopping OpenClaw
- Allowlists are optional โ only needed if you want dynamic model switching
- Check environment variables if the error persists after config changes
Valid Anthropic Model IDs (2026)
Here are the current valid model IDs you can use with OpenClaw and Anthropic:
anthropic/claude-sonnet-4-5-20250929โ Recommended Sonnet model (balanced performance)anthropic/claude-opus-4-5โ Highest quality Opus model (best reasoning)anthropic/claude-haiku-4โ Fastest Haiku model (quick responses)
Always include the anthropic/ prefix and the full version suffix. Check the Anthropic documentation for the latest model releases.
Want to Master AI Agent Development?
Join Vibe Coding Academy and learn how to build, deploy, and troubleshoot AI agents. Step-by-step guides, real-world projects, and a community of builders.
Join the AcademyRelated Resources
- Complete OpenClaw Setup Guide โ Full installation walkthrough
- Vibe Coding Fundamentals โ Learn the 5 essential AI coding skills
- OpenClaw GitHub Repository โ Official source code and issues