windmill-labs/windmill · error
AI mode "${args.mode}" is not enabled
Error message
AI mode "${args.mode}" is not enabled What it means
Thrown by the switch_mode tool handler in AIChatManager when the model requests a mode that is either not a recognized AI mode or is not visible on this instance (e.g. 'global' when global AI is disabled). The mode string comes straight from the LLM's tool arguments, so this is an input validation guard on model-produced values, not an internal state error.
Source
Thrown at frontend/src/lib/components/copilot/chat/AIChatManager.svelte.ts:2341
'flow',
...(isGlobalAiEnabled() ? ['global'] : []),
'navigator',
'API'
]
},
pendingPrompt: {
type: 'string',
description: 'The prompt to send to the new mode to fulfill the user request',
default: ''
}
},
required: ['mode']
}
}
},
fn: async ({ args, toolId, toolCallbacks }) => {
if (!isAIMode(args.mode) || !isAIModeVisible(args.mode)) {
throw new Error(`AI mode "${args.mode}" is not enabled`)
}
toolCallbacks.setToolStatus(toolId, { content: 'Switching to ' + args.mode + ' mode...' })
this.changeMode(args.mode, args.pendingPrompt, {
closeScriptSettings: true
})
toolCallbacks.setToolStatus(toolId, { content: 'Switched to ' + args.mode + ' mode' })
return 'Mode changed to ' + args.mode
}
}
openChat = () => {
// Nothing may open the docked pane in a workspace that hid the assistant.
if (get(copilotInfo).workspaceDisabled) {
return
}
chatState.size = this.savedSize > 0 ? this.savedSize : DEFAULT_SIZE
localStorage.setItem('ai-chat-open', 'true')
}View on GitHub (pinned to e474e8803c)
Solutions
- Switch only to modes the tool schema lists: script, flow, app, global, navigator, API
- Enable the missing mode in instance settings if it should be available on this deployment
- If the model keeps requesting an unavailable mode, drop it from context or restate the available modes in the prompt
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at frontend/src/lib/components/copilot/chat/AIChatManager.svelte.ts:2341 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/85a0c6285e7a65b3.
Report an issue: GitHub.