using subagents errors: Task Error: Unknown agent type: undefined is not a valid agent type #2142

Closed
opened 2026-02-16 17:34:21 -05:00 by yindo · 2 comments
Owner

Originally created by @sageil on GitHub (Oct 16, 2025).

Originally assigned to: @rekram1-node on GitHub.

Whenever I use a subagent, I get Task Error: Unknown agent type: undefined is not a valid agent type
The relevant part of the core agent which is meant to delegate tasks to a planner agent (subagent)

description: Core agent for the project handling the overall flow of the project
mode: primary
model: openrouter/qwen/qwen3-235b-a22b:free
tools:
  write: true
  edit: true
  bash: true
 
---

# Core Agent

You are the core agent for the project. You are responsible for the overall flow of the project.
Always use your subagents and tools provided to you to complete the task.

You have access to the following subagents: 
- `@subagents/task-manager` @task-manager
- `@subagents/planner` @planner

## Agent Workflow

- plan
  - Make a task file for the task in md
  - follow the task file to complete the task
- review and test the task
- update the task file with the results
- repeat the process for the next task
- when all tasks are complete, review the project and make sure all tasks are complete
- update the project file with the results
- repeat the process for the next project
- when all projects are complete, review the projects and make sure all projects are complete

This core agent orchestrates the development process through a structured workflow involving multiple specialized agents:

### 1. Planning Phase

- **Agent**: planner Agent - `@planner.md`
- **Purpose**: Analyze incoming requests and gather all relevant context
- **Actions**:
  - Understand the user's requirements and goals
  - Analyze existing codebase structure and patterns
  - Identify dependencies and potential impacts
  - Gather necessary context from related files and components
  - Create a comprehensive understanding of the task scope

Sub agent

description: Planning agent that analyzes requirements and gathers context to create comprehensive development plans
mode: subagent
model: openrouter/openai/gpt-oss-20b:free
tools:
  write: false
  edit: false
  bash: true
  task: true
---

# You are the Planner Agent responsible for analyzing incoming requests and creating comprehensive development plans

I tried it without the subagent set to task: true and gotten the same error

Image

I also noticed the documentation site doesn't list the task as tool which I found in an answer to an issue here

Originally created by @sageil on GitHub (Oct 16, 2025). Originally assigned to: @rekram1-node on GitHub. Whenever I use a subagent, I get `Task Error: Unknown agent type: undefined is not a valid agent type` The relevant part of the core agent which is meant to delegate tasks to a planner agent (subagent) ```md description: Core agent for the project handling the overall flow of the project mode: primary model: openrouter/qwen/qwen3-235b-a22b:free tools: write: true edit: true bash: true --- # Core Agent You are the core agent for the project. You are responsible for the overall flow of the project. Always use your subagents and tools provided to you to complete the task. You have access to the following subagents: - `@subagents/task-manager` @task-manager - `@subagents/planner` @planner ## Agent Workflow - plan - Make a task file for the task in md - follow the task file to complete the task - review and test the task - update the task file with the results - repeat the process for the next task - when all tasks are complete, review the project and make sure all tasks are complete - update the project file with the results - repeat the process for the next project - when all projects are complete, review the projects and make sure all projects are complete This core agent orchestrates the development process through a structured workflow involving multiple specialized agents: ### 1. Planning Phase - **Agent**: planner Agent - `@planner.md` - **Purpose**: Analyze incoming requests and gather all relevant context - **Actions**: - Understand the user's requirements and goals - Analyze existing codebase structure and patterns - Identify dependencies and potential impacts - Gather necessary context from related files and components - Create a comprehensive understanding of the task scope ``` Sub agent ```md description: Planning agent that analyzes requirements and gathers context to create comprehensive development plans mode: subagent model: openrouter/openai/gpt-oss-20b:free tools: write: false edit: false bash: true task: true --- # You are the Planner Agent responsible for analyzing incoming requests and creating comprehensive development plans ``` I tried it without the subagent set to `task: true` and gotten the same error <img width="1501" height="808" alt="Image" src="https://github.com/user-attachments/assets/02257a24-d7d0-443a-be0e-5c1c7fbc3ea7" /> I also noticed the documentation site doesn't list the task as tool which I found in an answer to an issue here
yindo closed this issue 2026-02-16 17:34:21 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Oct 16, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #1419: Task tool fails with "undefined is not an object (evaluating 'Q.model')" when launching sub-agents - This issue describes the exact same error pattern where the task tool fails with a model-related error when trying to launch subagents.

  • #1307: using agents (without a model in the config) shows: TypeError: undefined is not an object (evaluating 'Q.model') - This issue has the same "undefined is not an object (evaluating 'Q.model')" error, suggesting a common root cause related to model configuration in agent setups.

  • #3034: task tool "SyntaxError: Unexpected end of JSON input" - While this shows a different JSON parsing error, it's also related to task tool failures when calling subagents.

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Oct 16, 2025): This issue might be a duplicate of existing issues. Please check: - #1419: Task tool fails with "undefined is not an object (evaluating 'Q.model')" when launching sub-agents - This issue describes the exact same error pattern where the task tool fails with a model-related error when trying to launch subagents. - #1307: using agents (without a model in the config) shows: TypeError: undefined is not an object (evaluating 'Q.model') - This issue has the same "undefined is not an object (evaluating 'Q.model')" error, suggesting a common root cause related to model configuration in agent setups. - #3034: task tool "SyntaxError: Unexpected end of JSON input" - While this shows a different JSON parsing error, it's also related to task tool failures when calling subagents. Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Oct 17, 2025):

@sageil This is the model failing to delegate a subagent, it didn't properly call the task tool

@rekram1-node commented on GitHub (Oct 17, 2025): @sageil This is the model failing to delegate a subagent, it didn't properly call the task tool
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2142