windmill-labs/windmill · error

No script options passed

Error message

No script options passed

What it means

sendRequest throws this when mode is AIMode.SCRIPT and neither scriptEditorOptions nor a `lang` option was provided. Script generation needs the language and editor context; without either, the request cannot be built correctly.

Source

Thrown at frontend/src/lib/components/copilot/chat/AIChatManager.svelte.ts:3479

					? expandedInstructions
					: '(the user sent an empty message)'
			// Deliver background-job completions to the model as a preamble on this
			// turn (notify-only wake). Folded into the model-facing text only — the
			// display bubble keeps this.instructions, and no extra message is added, so
			// the display↔messages index pairing above stays intact. Ephemeral.
			const jobNotesPreamble =
				this.mode === AIMode.GLOBAL && this.pendingJobNotes.length > 0
					? this.pendingJobNotes.join('\n\n') + '\n\n'
					: ''
			if (jobNotesPreamble) this.pendingJobNotes = []
			const modelInstructions =
				this.mode === AIMode.GLOBAL
					? jobNotesPreamble + this.expandGlobalSkillCommand(oldInstructions)
					: oldInstructions
			this.instructions = ''

			if (this.mode === AIMode.SCRIPT && !this.scriptEditorOptions && !options.lang) {
				throw new Error('No script options passed')
			}

			// Message-attached files travel as references: the prompt lists them by id
			// and the model reads their content via the file tools. Register them in
			// the store before the request goes out so this turn's reads can already
			// see them. Registration failure must not block the send — the reference
			// just reads as missing and the model reports it.
			if (this.mode === AIMode.GLOBAL && files.length > 0) {
				try {
					this.attachedFiles.registerMessageFiles(files as (AttachedTextFile & { id: string })[])
				} catch (e) {
					console.error('Failed to register message-attached files', e)
				}
			}

			let userMessage: ChatCompletionMessageParam = {
				role: 'user',
				content: ''

View on GitHub (pinned to e474e8803c)

Solutions

  1. Pass `lang` in the sendRequest options, e.g. { mode: AIMode.SCRIPT, lang: 'bun' }.
  2. Wire scriptEditorOptions into the manager when using script mode.
  3. Only use SCRIPT mode from a context where the script editor is present.
  4. Default to GLOBAL mode if no script target exists.

Example fix

// before
await manager.sendRequest({ instructions: 'write a scraper', mode: AIMode.SCRIPT })
// after
await manager.sendRequest({ instructions: 'write a scraper', mode: AIMode.SCRIPT, lang: 'bun' })
Defensive patterns

Strategy: validation

Validate before calling

if (mode === AIMode.SCRIPT && !lang) {
  throw new Error('SCRIPT mode requires a lang option')
}

Try / catch

try {
  await manager.sendRequest({ instructions, mode: AIMode.SCRIPT, lang })
} catch (e) {
  if (e.message === 'No script options passed') {
    await manager.sendRequest({ instructions, mode: AIMode.SCRIPT, lang: 'bun' })
  } else throw e
}

Prevention

When it happens

Trigger: Calling sendRequest with mode=SCRIPT while scriptEditorOptions is unset and options.lang is omitted — typically a programmatic/CLI-driven call or a chat mounted outside the script editor.

Common situations: Custom integrations invoking the AI manager directly and forgetting the lang option; chat component reused in a page with no script editor bound; refactor removed the options wiring.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/6a3b3097f3625e4c. Report an issue: GitHub.