Bug type
Behavior bug (incorrect output/state without crash)
Summary
When spawning a subagent with sessions_spawn using an NVIDIA provider configured as "api": "openai-completions", OpenClaw sends Anthropic-style message content (arrays with type objects) instead of OpenAI-style simple strings. This causes the NVIDIA API to reject requests with HTTP 400 errors.
bug was created using openclaw *
Steps to reproduce
Configuration
{
"models": {
"providers": {
"nvidia": {
"baseUrl": "https://integrate.api.nvidia.com/v1",
"apiKey": "nvapi-XXXXXXXXXX",
"api": "openai-completions",
"models": [
{
"id": "qwen/qwen2.5-7b-instruct",
"name": "Qwen 2.5 7B Instruct",
"reasoning": false,
"input": ["text"],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 128000,
"maxTokens": 8192
}
]
}
}
}
}
## Steps to Reproduce
1. Configure NVIDIA provider with `"api": "openai-completions"`
2. Spawn a subagent using the NVIDIA model:
```javascript
sessions_spawn({
agentId: "test-agent",
mode: "run",
model: "nvidia/qwen/qwen2.5-7b-instruct",
task: "Say hello",
runTimeoutSeconds: 60
})
- Observe HTTP 400 error in logs
Expected behavior
OpenClaw should send OpenAI-compatible message format:
{
"model": "qwen/qwen2.5-7b-instruct",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Say hello"
}
]
}
Actual behavior
Actual Behavior
OpenClaw sends Anthropic-style message format:
{
"model": "qwen/qwen2.5-7b-instruct",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "Say hello"
}
]
}
]
}
### OpenClaw version
2026.3.13 (61d171a)
### Operating system
macOS (Darwin 25.3.0, arm64)
### Install method
npm global
### Model
nvidia/qwen/qwen2.5-7b-instruct
### Provider / routing chain
openclaw -> nvidia
### Config file / key location
~/.openclaw/openclaw.json ; models.providers.nvidia.baseUrl ; https://integrate.api.nvidia.com/v1
### Additional provider/model setup details
(Note: Default is anthropic/claude-sonnet-4-5, but bug occurs when spawning with NVIDIA model)
### Logs, screenshots, and evidence
```shell
Error Logs
2026-03-19T00:20:40.070Z warn agent/embedded {"subsystem":"agent/embedded"}
{"event":"embedded_run_agent_end","tags":["error_handling","lifecycle","agent_end","assistant_error"],
"runId":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","isError":true,
"error":"HTTP 400: \"[{'type': 'string_type', 'loc': ('body', 'messages', 1, 'content'),
'msg': 'Input should be a valid string', 'input': [{'type': 'text', 'text': '[Wed 2026-03-18 19:20 CDT]
[Subagent Context] You are running as a subagent (depth 1/1). Results auto-announce to your requester...",
"failoverReason":"auth","model":"qwen/qwen2.5-7b-instruct","provider":"nvidia",
"rawErrorPreview":"400 \"[{'type': 'string_type', 'loc': ('body', 'messages', 1, 'content'),
'msg': 'Input should be a valid string', 'input': [{'type': 'text', 'text': ..."}
2026-03-19T00:20:40.081Z warn agent/embedded {"subsystem":"agent/embedded"}
[context-overflow-diag] sessionKey=agent:test-agent:subagent:XXXXXXXX provider=nvidia/qwen/qwen2.5-7b-instruct
source=assistantError messages=2 compactionAttempts=0 observedTokens=unknown
error=400 "[{'type': 'string_type', 'loc': ('body', 'messages', 1, 'content'),
'msg': 'Input should be a valid string', 'input': [{'type': 'text', 'text': ...
**Key error from NVIDIA API:**
'msg': 'Input should be a valid string'
'loc': ('body', 'messages', 1, 'content')
## Verification: Direct API Call Works
To confirm the NVIDIA API itself works correctly, a direct curl request succeeds:
curl -X POST "https://integrate.api.nvidia.com/v1/chat/completions" \
-H "Authorization: Bearer nvapi-XXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen/qwen2.5-7b-instruct",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Say hello"}
],
"temperature": 0.6,
"max_tokens": 100
}'
**Response (success):**
{
"id": "chat-XXXXXXXX",
"object": "chat.completion",
"created": 1773879437,
"model": "qwen/qwen2.5-7b-instruct",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! I'm here and ready to help."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 32,
"total_tokens": 44,
"completion_tokens": 12
}
}
This confirms:
- ✅ NVIDIA API works with OpenAI-style simple string content
- ✅ Model responds correctly
- ✅ Authentication is valid
- ❌ OpenClaw is sending wrong message format
Impact and severity
This prevents using any OpenAI-compatible provider that strictly validates message format according to OpenAI spec. NVIDIA NIM is one example, but this could affect other providers as well.
Workaround -
None currently available. The message format is constructed internally by OpenClaw's subagent spawning system and cannot be overridden via configuration or agent instructions.
Additional information
This appears to be a second NVIDIA provider formatting bug, discovered the same day as #49369 (NVIDIA model ID prefix stripping). Both issues suggest broader request formatting problems with the NVIDIA provider:
Both block using NVIDIA provider with sessions_spawn in OpenClaw 2026.3.13.
Additional Context
- The
"api": "openai-completions" config value is correctly set
- Error occurs on first API call before agent runs
- Happens with all task types (simple and complex)
- Compaction attempts also fail with same error
- Both
mode: "run" and mode: "session" affected
Suspected Root Cause
OpenClaw's subagent system appears to always use Anthropic's message content format (content as array of objects with type field) regardless of the provider's api setting. The code likely needs to conditionally format messages based on the target provider's API type.
Bug type
Behavior bug (incorrect output/state without crash)
Summary
When spawning a subagent with
sessions_spawnusing an NVIDIA provider configured as"api": "openai-completions", OpenClaw sends Anthropic-style message content (arrays withtypeobjects) instead of OpenAI-style simple strings. This causes the NVIDIA API to reject requests with HTTP 400 errors.bug was created using openclaw *
Steps to reproduce
Configuration
{ "models": { "providers": { "nvidia": { "baseUrl": "https://integrate.api.nvidia.com/v1", "apiKey": "nvapi-XXXXXXXXXX", "api": "openai-completions", "models": [ { "id": "qwen/qwen2.5-7b-instruct", "name": "Qwen 2.5 7B Instruct", "reasoning": false, "input": ["text"], "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 128000, "maxTokens": 8192 } ] } } } } ## Steps to Reproduce 1. Configure NVIDIA provider with `"api": "openai-completions"` 2. Spawn a subagent using the NVIDIA model: ```javascript sessions_spawn({ agentId: "test-agent", mode: "run", model: "nvidia/qwen/qwen2.5-7b-instruct", task: "Say hello", runTimeoutSeconds: 60 })Expected behavior
OpenClaw should send OpenAI-compatible message format:
{ "model": "qwen/qwen2.5-7b-instruct", "messages": [ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Say hello" } ] }Actual behavior
Actual Behavior
OpenClaw sends Anthropic-style message format:
{ "model": "qwen/qwen2.5-7b-instruct", "messages": [ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": [ { "type": "text", "text": "Say hello" } ] } ] } ### OpenClaw version 2026.3.13 (61d171a) ### Operating system macOS (Darwin 25.3.0, arm64) ### Install method npm global ### Model nvidia/qwen/qwen2.5-7b-instruct ### Provider / routing chain openclaw -> nvidia ### Config file / key location ~/.openclaw/openclaw.json ; models.providers.nvidia.baseUrl ; https://integrate.api.nvidia.com/v1 ### Additional provider/model setup details (Note: Default is anthropic/claude-sonnet-4-5, but bug occurs when spawning with NVIDIA model) ### Logs, screenshots, and evidence ```shell Error Logs 2026-03-19T00:20:40.070Z warn agent/embedded {"subsystem":"agent/embedded"} {"event":"embedded_run_agent_end","tags":["error_handling","lifecycle","agent_end","assistant_error"], "runId":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","isError":true, "error":"HTTP 400: \"[{'type': 'string_type', 'loc': ('body', 'messages', 1, 'content'), 'msg': 'Input should be a valid string', 'input': [{'type': 'text', 'text': '[Wed 2026-03-18 19:20 CDT] [Subagent Context] You are running as a subagent (depth 1/1). Results auto-announce to your requester...", "failoverReason":"auth","model":"qwen/qwen2.5-7b-instruct","provider":"nvidia", "rawErrorPreview":"400 \"[{'type': 'string_type', 'loc': ('body', 'messages', 1, 'content'), 'msg': 'Input should be a valid string', 'input': [{'type': 'text', 'text': ..."} 2026-03-19T00:20:40.081Z warn agent/embedded {"subsystem":"agent/embedded"} [context-overflow-diag] sessionKey=agent:test-agent:subagent:XXXXXXXX provider=nvidia/qwen/qwen2.5-7b-instruct source=assistantError messages=2 compactionAttempts=0 observedTokens=unknown error=400 "[{'type': 'string_type', 'loc': ('body', 'messages', 1, 'content'), 'msg': 'Input should be a valid string', 'input': [{'type': 'text', 'text': ... **Key error from NVIDIA API:** 'msg': 'Input should be a valid string' 'loc': ('body', 'messages', 1, 'content') ## Verification: Direct API Call Works To confirm the NVIDIA API itself works correctly, a direct curl request succeeds: curl -X POST "https://integrate.api.nvidia.com/v1/chat/completions" \ -H "Authorization: Bearer nvapi-XXXXXXXXXX" \ -H "Content-Type: application/json" \ -d '{ "model": "qwen/qwen2.5-7b-instruct", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Say hello"} ], "temperature": 0.6, "max_tokens": 100 }' **Response (success):** { "id": "chat-XXXXXXXX", "object": "chat.completion", "created": 1773879437, "model": "qwen/qwen2.5-7b-instruct", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Hello! I'm here and ready to help." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 32, "total_tokens": 44, "completion_tokens": 12 } } This confirms: - ✅ NVIDIA API works with OpenAI-style simple string content - ✅ Model responds correctly - ✅ Authentication is valid - ❌ OpenClaw is sending wrong message formatImpact and severity
This prevents using any OpenAI-compatible provider that strictly validates message format according to OpenAI spec. NVIDIA NIM is one example, but this could affect other providers as well.
Workaround -
None currently available. The message format is constructed internally by OpenClaw's subagent spawning system and cannot be overridden via configuration or agent instructions.
Additional information
This appears to be a second NVIDIA provider formatting bug, discovered the same day as #49369 (NVIDIA model ID prefix stripping). Both issues suggest broader request formatting problems with the NVIDIA provider:
nvidia/prefix in model ID fail with 404 #49369: Model ID field formatted incorrectly → HTTP 404Both block using NVIDIA provider with
sessions_spawnin OpenClaw 2026.3.13.Additional Context
"api": "openai-completions"config value is correctly setmode: "run"andmode: "session"affectedSuspected Root Cause
OpenClaw's subagent system appears to always use Anthropic's message content format (content as array of objects with
typefield) regardless of the provider'sapisetting. The code likely needs to conditionally format messages based on the target provider's API type.