Skip to content

[Bug]: Non-main agent may miss models.json and fail with "Unknown model" when provider plan is empty #58289

Description

@xiangri678

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

When a non-main agent has no models.json and provider resolution returns empty, startup skips models.json generation and later fails with "Unknown model".

Steps to reproduce

  1. Prepare main agent with a valid ~/.openclaw/agents/main/agent/models.json.
  2. Call agents.create to create a new non-main agent; the new agent directory exists but has no models.json initially.
  3. Ensure provider resolution for the non-main agent is empty (no implicit provider discovered and no explicit provider written for that agent).
  4. Start or spawn a session using that non-main agent.
  5. Observe models.json is still missing under that agent directory.
  6. Observe runtime failure: Unknown model: /.

Expected behavior

Non-main agent startup should not reach runtime with missing model registry in this case (bootstrap from main agent models.json, or fail early with actionable guidance).

Actual behavior

Non-main agent keeps missing models.json and fails at runtime with Unknown model.

OpenClaw version

2026.3.28 (also reproducible on main as of 2026-03-31)

Operating system

Windows 11

Install method

npm global

Model

Any provider/model that relies on catalog entry under non-main agent (example: openai/gpt-4.1-mini)

Provider / routing chain

openclaw -> local gateway -> per-agent model registry

Additional provider/model setup details

No response

Logs, screenshots, and evidence

- non-main agent path exists but models.json missing
- main agent models.json exists and non-empty
- runtime error:
  Unknown model: <provider>/<modelId>

Impact and severity

Affected: users with non-main agents (especially newly created agents)
Severity: workflow blocking
Frequency: reproducible under empty-provider + missing models.json condition
Consequence: non-main agent chat/session cannot start successfully

Additional information

Related but different:

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingbug:behaviorIncorrect behavior without a crashclawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions