What this thread does
Agent type '<name>' not found. Available agents: ... means the subagent you asked for is not registered in this session. First action: create .claude/agents/<name>.md (project) or ~/.claude/agents/<name>.md (all projects) with name and description frontmatter and the system prompt as the body, then restart the session and compare path and frontmatter against the checklist below.
Do first: restart the session after creating the file.
Not for: loading an MCP server for one subagent only (see claude-code-subagent-only-mcp-servers) or starting a subagent that inherits the conversation (see claude-code-subtask-fork-subagent-inherits-conversation-context).
Evidence status: file format, locations and fields are from the official sub-agents page, checked 2026-10-30. One open public bug report supports the not-found symptom. No subagent was created in a lab run for this thread.
Diagnostic: Agent type '<name>' not found. Available agents: ...
The Agent tool returns this when the name you asked for is not in the registry for the current session. A public report (see Evidence) shows it for a valid file added mid-session.
Minimal file
.claude/agents/code-reviewer.md (the docs' example):
---
name: code-reviewer
description: Reviews code for quality and best practices
tools: Read, Glob, Grep
model: sonnet
---
You are a code reviewer. When invoked, analyze the code and provide
specific, actionable feedback on quality, security, and best practices.
Claude decides when to delegate from description, so write it as "when to use this agent".
Where files live (higher priority wins on a name clash)
| Priority | Location | Scope |
|---|---|---|
| 1 | Managed settings | Organization |
| 2 | --agents CLI flag | Current session |
| 3 | .claude/agents/ | Current project |
| 4 | ~/.claude/agents/ | All your projects |
| 5 | Plugin agents/ directory | Where the plugin is enabled |
Within one .claude/agents/ tree, duplicate names are not resolved by a documented rule: Claude Code loads only one of them. Across nested project directories the definition closest to the working directory wins.
Frontmatter fields
- Required:
name(cannot contain:) anddescription. - Optional:
tools(allowlist, comma-separated string or YAML list; omitted means it inherits the tools available to subagents),disallowedTools(removed from the inherited or specified tool list),model(sonnet,opus,haiku,fable, a full model ID, orinherit),permissionMode(default,acceptEdits,auto,dontAsk,bypassPermissions,plan,manual),maxTurns,skills,mcpServers,hooks,memory,background,effort,isolation(worktree),color,initialPromptand others listed on the page. - Multi-word field names are camelCase. Unrecognized fields are ignored without an error, so a misspelled field (for example
allowed-toolsinstead oftools) silently does nothing.
Do first when it is not found
1. Run /agents or ask Claude to list agents. On v2.1.197 and earlier, /agents opens an interactive wizard; after that version it prints a reminder to ask Claude or edit the files directly. 2. Check the path: .claude/agents/ is relative to the project folder you started claude in; user-level is ~/.claude/agents/. A file in .claude/commands/ or .claude/skills/ is a different feature. 3. Check the file is .md, frontmatter is valid YAML between --- lines, and name and description are present. 4. Restart the session. Per the docs, Claude Code watches both agents directories and detects changes "within a few seconds", but a restart is still needed when you add or edit a subagent in a directory added with --add-dir or /add-dir, or when the session started with --disable-slash-commands. 5. If another file has the same name at a higher priority (table above), it shadows yours.
Evidence
One open report: Agent files added to ~/.claude/agents/ mid-session were not spawnable for several minutes although the docs promise detection in seconds; a fresh claude -p process loaded the same files immediately, and the error was Agent type 'zz-probe-a' not found. Available agents: ... (issue 98528, opened 2026-09-30 by george-elphick-talieisin, Claude Code 2.1.285, macOS, state open). The reporter suspects the reload follows turn boundaries; that is the reporter's guess, not confirmed.
Limits
The field list above is a subset; the docs list more fields and may change each release. Not tested here: Windows desktop-app behavior, plugin-provided agents, --agents JSON. The wizard cutoff (v2.1.197 and earlier) is as documented. checked 2026-10-30.
Started from a post by @Anthropic Claude Code documentation, packaged by the editor. Original post