Vibe Coding Academy Logo Vibe Coding Academy

How to Fix OpenClaw Unknown Model Error

Complete troubleshooting guide for "Agent failed before reply: Unknown model" with valid Anthropic model IDs.

Published February 6, 2026 ยท 8 min read

The Error

If you're seeing this error in your OpenClaw logs, you're not alone:

[openclaw] Agent failed before reply: Unknown model: anthropic/claude-3.5-sonnet

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

GitHub Context

This is a known issue in the OpenClaw community:

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:

/root/.openclaw/openclaw.json

Verify the file exists:

ls -l /root/.openclaw/openclaw.json

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:

nano /root/.openclaw/openclaw.json

Find the agents.defaults.model section and update it to use a valid versioned Anthropic model ID:

โœ… Valid Example (Sonnet, Recommended)

{ "agents": { "defaults": { "model": { "primary": "anthropic/claude-sonnet-4-5-20250929" } } } }

โœ… Valid Example (Opus, Highest Quality)

{ "agents": { "defaults": { "model": { "primary": "anthropic/claude-opus-4-5" } } } }

After editing, save the file:

3(Optional) Allow Multiple Models

If you want to dynamically switch between models, you can configure an allowlist:

{ "model": { "primary": "anthropic/claude-sonnet-4-5-20250929", "allowed": [ "anthropic/claude-sonnet-4-5-20250929", "anthropic/claude-opus-4-5" ] } }

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:

ps aux | grep -i '[o]penclaw'

You'll see output like:

root 12345 0.5 2.1 openclaw tui
root 12346 0.3 1.8 openclaw-gateway

Identify the parent PID:

ps -o pid,ppid,cmd -p 12345

The PPID column shows the parent process ID.

Stop the parent process:

kill -TERM <PPID>
sleep 2
kill -KILL <PPID>

Clean up any remaining children:

pkill -f openclaw-gateway

Confirm OpenClaw is fully stopped:

ps aux | grep -i '[o]penclaw' || echo "fully stopped"

You should see "fully stopped" if no processes remain.

5Restart OpenClaw

Start OpenClaw again with your normal command:

openclaw tui

(Or whatever command you typically use to start OpenClaw.)

6Verify Model Loaded

Check that the correct model is now loaded:

openclaw gateway call config.get --params '{}' | grep '"primary"'

Expected output:

"primary": "anthropic/claude-sonnet-4-5-20250929"

If you see your configured model ID, you're good to go!

7Confirm Error Is Gone

Monitor the logs in real-time:

openclaw logs --follow

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:

env | grep -i anthropic

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

Valid Anthropic Model IDs (2026)

Here are the current valid model IDs you can use with OpenClaw and Anthropic:

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 Academy

Related Resources

Abdul Khan
Written by
Abdul Khan