can1357/oh-my-pi · error · StructuredSubagentError
Agent "${agentName}" is disabled in settings. Enable it via
Error message
Agent "${agentName}" is disabled in settings. Enable it via /agents, or use a different agent type.${enabled.length > 0 ? ` Available: ${enabled.join(", ")}` : ""} What it means
Thrown in preflight when the requested agent exists but is listed in the `task.disabledAgents` setting. The library refuses to spawn disabled agents and suggests enabling via /agents, listing which agents remain enabled.
Source
Thrown at packages/coding-agent/src/task/structured-subagent.ts:266
await request.session.settings.reloadFromDisk();
const spawnPolicy = resolveSpawnPolicy(request.session.getSessionSpawns());
const agentName = request.agent?.trim() || spawnPolicy.defaultAgent;
const planMode = request.session.getPlanModeState?.()?.enabled === true;
assertPlanControlsAllowed(request, planMode);
assertDepthAndSpawnAllowed(request, agentName);
const discovery = await discoverAgents(request.session.cwd, undefined, request.session.effectiveExtensionRoots?.());
const agent = getAgent(discovery.agents, agentName);
if (!agent) {
const available = discovery.agents.map(candidate => candidate.name).join(", ") || "none";
throw new StructuredSubagentError("preflight", `Unknown agent "${agentName}". Available: ${available}`);
}
const disabledAgents = request.session.settings.get("task.disabledAgents") as string[];
if (disabledAgents.includes(agentName)) {
const enabled = discovery.agents
.filter(candidate => !disabledAgents.includes(candidate.name))
.map(candidate => candidate.name);
throw new StructuredSubagentError(
"preflight",
`Agent "${agentName}" is disabled in settings. Enable it via /agents, or use a different agent type.${enabled.length > 0 ? ` Available: ${enabled.join(", ")}` : ""}`,
);
}
const effectiveAgent = planMode ? createPlanModeAgent(agent) : agent;
const schema = resolveSchema(request, effectiveAgent);
if (schema.source === "caller" || (schema.source !== "none" && schema.mode === "strict")) {
const { error } = buildOutputValidator(schema.schema);
if (error) {
const scope =
schema.source === "caller" ? (schema.mode === "strict" ? "strict caller" : "caller") : "strict effective";
throw new StructuredSubagentError("preflight", `Invalid ${scope} output schema: ${error}`);
}
}
const agentModelOverrides = request.session.settings.get("task.agentModelOverrides");
const parentActiveModelPattern = request.session.getActiveModelString?.();
const modelResolution = {View on GitHub (pinned to 9690622007)
Solutions
- Remove the agent from `task.disabledAgents` in settings or enable it via /agents
- Pick one of the `Available:` enabled agents listed in the error
- Update prompts/workflows to stop referencing the disabled agent
Example fix
// settings before
{ "task.disabledAgents": ["researcher"] }
// after
{ "task.disabledAgents": [] } Defensive patterns
Strategy: validation
Validate before calling
const disabled = session.settings.get("task.disabledAgents") as string[];
if (disabled.includes(agentName)) {
throw new Error(`Agent "${agentName}" is disabled; enabled: ${discovered.map(a => a.name).filter(n => !disabled.includes(n)).join(", ")}`);
}
await task({ agent: agentName }); Try / catch
try {
await task(req);
} catch (e) {
if (e instanceof StructuredSubagentError && e.message.includes("is disabled in settings")) {
return task({ ...req, agent: firstEnabledAgent });
}
throw e;
} Prevention
- Read task.disabledAgents when generating prompts that reference agents
- Keep disabledAgents minimal and review it when workflows break
- Prefer /agents toggles over hand-editing settings to stay consistent
When it happens
Trigger: `session.settings.get("task.disabledAgents")` contains the requested agentName; user (or org config) disabled the agent but a prompt or workflow still calls it.
Common situations: Org-wide settings disabling expensive or risky agents while stale prompts still reference them; user toggled an agent off in /agents and a saved workflow broke; disabledAgents configured to constrain costs.
Related errors
- Subagent isolated execution requires task.isolation.mode to
- vault:// is disabled. Enable it by setting `vault.enabled =
- Cannot spawn another agent at task depth ${taskDepth}; maxim
- URL reads are disabled by settings.
- Image submission is disabled by settings (images.blockImages
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/e7867ca2124febdb.
Report an issue: GitHub.