{"record":{"id":"e7867ca2124febdb","repo":"can1357/oh-my-pi","slug":"agent-agentname-is-disabled-in-settings-enab","errorCode":null,"errorMessage":"Agent \"${agentName}\" is disabled in settings. Enable it via /agents, or use a different agent type.${enabled.length > 0 ? ` Available: ${enabled.join(\", \")}` : \"\"}","messagePattern":"Agent \"(.+?)\" is disabled in settings\\. Enable it via /agents, or use a different agent type\\.(.+?)` : \"\"\\}","errorType":"validation","errorClass":"StructuredSubagentError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/task/structured-subagent.ts","lineNumber":266,"sourceCode":"\tawait request.session.settings.reloadFromDisk();\n\tconst spawnPolicy = resolveSpawnPolicy(request.session.getSessionSpawns());\n\tconst agentName = request.agent?.trim() || spawnPolicy.defaultAgent;\n\tconst planMode = request.session.getPlanModeState?.()?.enabled === true;\n\tassertPlanControlsAllowed(request, planMode);\n\tassertDepthAndSpawnAllowed(request, agentName);\n\n\tconst discovery = await discoverAgents(request.session.cwd, undefined, request.session.effectiveExtensionRoots?.());\n\tconst agent = getAgent(discovery.agents, agentName);\n\tif (!agent) {\n\t\tconst available = discovery.agents.map(candidate => candidate.name).join(\", \") || \"none\";\n\t\tthrow new StructuredSubagentError(\"preflight\", `Unknown agent \"${agentName}\". Available: ${available}`);\n\t}\n\tconst disabledAgents = request.session.settings.get(\"task.disabledAgents\") as string[];\n\tif (disabledAgents.includes(agentName)) {\n\t\tconst enabled = discovery.agents\n\t\t\t.filter(candidate => !disabledAgents.includes(candidate.name))\n\t\t\t.map(candidate => candidate.name);\n\t\tthrow new StructuredSubagentError(\n\t\t\t\"preflight\",\n\t\t\t`Agent \"${agentName}\" is disabled in settings. Enable it via /agents, or use a different agent type.${enabled.length > 0 ? ` Available: ${enabled.join(\", \")}` : \"\"}`,\n\t\t);\n\t}\n\n\tconst effectiveAgent = planMode ? createPlanModeAgent(agent) : agent;\n\tconst schema = resolveSchema(request, effectiveAgent);\n\tif (schema.source === \"caller\" || (schema.source !== \"none\" && schema.mode === \"strict\")) {\n\t\tconst { error } = buildOutputValidator(schema.schema);\n\t\tif (error) {\n\t\t\tconst scope =\n\t\t\t\tschema.source === \"caller\" ? (schema.mode === \"strict\" ? \"strict caller\" : \"caller\") : \"strict effective\";\n\t\t\tthrow new StructuredSubagentError(\"preflight\", `Invalid ${scope} output schema: ${error}`);\n\t\t}\n\t}\n\tconst agentModelOverrides = request.session.settings.get(\"task.agentModelOverrides\");\n\tconst parentActiveModelPattern = request.session.getActiveModelString?.();\n\tconst modelResolution = {","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/task/structured-subagent.ts#L248-L284","documentation":"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.","triggerScenarios":"`session.settings.get(\"task.disabledAgents\")` contains the requested agentName; user (or org config) disabled the agent but a prompt or workflow still calls it.","commonSituations":"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.","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"],"exampleFix":"// settings before\n{ \"task.disabledAgents\": [\"researcher\"] }\n// after\n{ \"task.disabledAgents\": [] }","handlingStrategy":"validation","validationCode":"const disabled = session.settings.get(\"task.disabledAgents\") as string[];\nif (disabled.includes(agentName)) {\n  throw new Error(`Agent \"${agentName}\" is disabled; enabled: ${discovered.map(a => a.name).filter(n => !disabled.includes(n)).join(\", \")}`);\n}\nawait task({ agent: agentName });","typeGuard":null,"tryCatchPattern":"try {\n  await task(req);\n} catch (e) {\n  if (e instanceof StructuredSubagentError && e.message.includes(\"is disabled in settings\")) {\n    return task({ ...req, agent: firstEnabledAgent });\n  }\n  throw e;\n}","preventionTips":["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"],"tags":["subagent","disabled-agent","settings","configuration"],"backgroundTag":"agent-disabled-in-settings","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}