openclaw - 💡(How to fix) Fix Bug: sessions_spawn fails with 'unexpected property spawnedBy/workspaceDir' [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#52792Fetched 2026-04-08 01:19:20
View on GitHub
Comments
1
Participants
2
Timeline
1
Reactions
0
Timeline (top)
commented ×1

Error Message

Error returned immediately. Gateway log shows:

Root Cause

In agent-BeieZAG2.js, the gateway injects spawnedBy and workspaceDir into agent params before validation. However, the validation schema has additionalProperties: false and does not include these fields, causing rejection.

Code Example

invalid agent params: at root: unexpected property 'spawnedBy'; at root: unexpected property 'workspaceDir'

---

[ws] ⇄ res ✗ agent 4ms errorCode=INVALID_REQUEST errorMessage=invalid agent params: at root: unexpected property 'spawnedBy'; at root: unexpected property 'workspaceDir'
RAW_BUFFERClick to expand / collapse

Bug Description

sessions_spawn tool consistently fails with:

invalid agent params: at root: unexpected property 'spawnedBy'; at root: unexpected property 'workspaceDir'

Steps to Reproduce

  1. Call sessions_spawn from the main agent session (any runtime: subagent or default)
  2. Any task text, any model

Expected Behavior

Subagent session spawns successfully.

Actual Behavior

Error returned immediately. Gateway log shows:

[ws] ⇄ res ✗ agent 4ms errorCode=INVALID_REQUEST errorMessage=invalid agent params: at root: unexpected property 'spawnedBy'; at root: unexpected property 'workspaceDir'

Analysis

In agent-BeieZAG2.js, the gateway injects spawnedBy and workspaceDir into agent params before validation. However, the validation schema has additionalProperties: false and does not include these fields, causing rejection.

Environment

  • OpenClaw 2026.3.13 (gateway + CLI)
  • Linux 6.17.0-14-generic x64
  • Node v25.6.1

extent analysis

Fix Plan

To fix the issue, we need to update the validation schema to include the spawnedBy and workspaceDir properties.

Code Changes

We can achieve this by modifying the validation schema in agent-BeieZAG2.js as follows:

const validationSchema = {
  // ... existing properties ...
  spawnedBy: { type: 'string' },
  workspaceDir: { type: 'string' },
  // ... other properties ...
  additionalProperties: false
};

Alternatively, we can set additionalProperties to true to allow any additional properties:

const validationSchema = {
  // ... existing properties ...
  additionalProperties: true
};

However, this approach may reduce the effectiveness of the validation.

Configuration Changes

No configuration changes are required for this fix.

Temporary Workaround

If the fix cannot be deployed immediately, a temporary workaround is to remove the spawnedBy and workspaceDir properties from the agent params before validation.

Verification

To verify that the fix worked, call sessions_spawn from the main agent session and check that the subagent session spawns successfully. The gateway log should no longer show the INVALID_REQUEST error.

Extra Tips

  • Make sure to test the updated validation schema thoroughly to ensure it does not introduce any new issues.
  • Consider adding additional validation for the spawnedBy and workspaceDir properties to ensure they conform to the expected format.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING