claude-code - 💡(How to fix) Fix [BUG] Race condition in plugin agent setting resolution [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
anthropics/claude-code#47774Fetched 2026-04-15 06:42:44
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Author
Timeline (top)
labeled ×5commented ×1

Error Message

Error Messages/Logs

Root Cause

There's a race condition in the Claude Code startup sequence: when a plugin provides an agent setting via its settings.json, the setting is silently dropped because the merged settings cache is primed before plugin loading completes.

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

There's a race condition in the Claude Code startup sequence: when a plugin provides an agent setting via its settings.json, the setting is silently dropped because the merged settings cache is primed before plugin loading completes.

What Should Happen?

Agent resolution should be deferred after plugin loading completes. This will then allow the agent: setting in the plugin's settings.json to be merged properly.

Error Messages/Logs

Steps to Reproduce

  1. Create a plugin which includes an agent. Create settings.json with {"agent": "[plugin_name]:[agent_name]"} at the plugin root.
  2. Install plugin with local scope in a directory.
  3. Run claude in that directory.
  4. The agent fails to load as the main agent in the session.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.1.87

Claude Code Version

2.1.105

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

No response

extent analysis

TL;DR

Deferring agent resolution until after plugin loading completes is likely to fix the issue with the agent setting being silently dropped.

Guidance

  • Review the startup sequence of Claude Code to identify where the merged settings cache is being primed and consider delaying this step until plugin loading is complete.
  • Verify that the agent setting is being properly merged into the settings cache after plugin loading by adding logging or debugging statements.
  • Check the plugin loading mechanism to ensure that it is properly triggering the update of the merged settings cache.
  • Consider adding a check to ensure that the agent setting is not being overwritten or dropped during the plugin loading process.

Example

No code snippet is provided as the issue does not contain sufficient information to create a specific example.

Notes

The issue appears to be a regression, and the last working version was 2.1.87. It may be helpful to compare the changes between version 2.1.87 and 2.1.105 to identify the cause of the issue.

Recommendation

Apply a workaround to defer agent resolution until after plugin loading completes, as this is likely to fix the issue and allow the agent setting to be properly merged.

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