anthropics / anthropics/claude-code

[BUG] CLAUDE_CODE_SUBAGENT_MODEL Inheritance Issue

オープン
#92,715 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
api:anthropic area:agents bug platform:macos
主要言語
Python
スター
145k
フォーク
23.1k
PR マージ指標
PR 指標を取得中

説明

### Preflight Checklist

- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code

### What's Wrong?

When the main session is configured to a local model via ANTHROPIC_API_KEY routing, CLAUDE_CODE_SUBAGENT_MODEL set to the local model name, claude-code-guide/named subagents still fail with claude-haiku-4-5-20251001 not found, while subagent_type: "fork" correctly inherits the local model

### What Should Happen?

The subagent should inherit the model the main session is using. The parameter is set for inheritance but it still defaults to Haiku

### Error Messages/Logs

```shell
Agent "Claude Code hooks guide" failed: Agent terminated early due to an API error: There's an issue with the selected model
(claude-haiku-4-5-20251001). It may not exist or you may not have access to it. Run /model to pick a different model. (error type
model_not_found, HTTP 404, model sent to the API: claude-haiku-4-5-20251001)
```

### Steps to Reproduce

Issue a prompt that will call a subagent while the model is set to a local model. The subagent will fail saying it has an API Error with the selected model (Claude-haiku-4-5-20251001.

### Claude Model

Other

### Is this a regression?

I don't know

### Last Working Version

_No response_

### Claude Code Version

2.1.263

### Platform

Anthropic API

### Operating System

macOS

### Terminal/Shell

Terminal.app (macOS)

### Additional Information

_No response_

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

Start by reproducing the failure with a local model, CLAUDE_CODE_SUBAGENT_MODEL, and a named subagent, then compare it with subagent_type: "fork", which reportedly inherits correctly. Trace where the main-session model is selected for each subagent path; done means named subagents use the configured model instead of defaulting to claude-haiku-4-5-20251001.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
ai, api, cli
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
52/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。