windmill-labs/windmill · warning

Fixing frontend code is not supported

Error message

Fixing frontend code is not supported

What it means

The copilot's code-fix prompt builder supports fixing backend (server-side) script errors only. When scriptOptions.type === 'fix' and scriptOptions.language === 'frontend' it throws, because there is no frontend fix flow wired into the prompt template ({error} replacement path).

Source

Thrown at frontend/src/lib/components/copilot/lib.ts:864

		}
	}
	return prompt
}

async function getPrompts(scriptOptions: CopilotOptions) {
	const promptsConfig = PROMPTS_CONFIGS[scriptOptions.type]
	let prompt = promptsConfig.prompts[scriptOptions.language].prompt
	if (scriptOptions.type !== 'fix') {
		prompt = prompt.replace('{description}', scriptOptions.description)
	}

	if (scriptOptions.type !== 'gen') {
		prompt = prompt.replace('{code}', scriptOptions.code)
	}

	if (scriptOptions.type === 'fix') {
		if (scriptOptions.language === 'frontend') {
			throw new Error('Fixing frontend code is not supported')
		}
		prompt = prompt.replace('{error}', scriptOptions.error)
	}

	prompt = await addResourceTypes(scriptOptions, prompt)

	prompt = addDBSChema(scriptOptions, prompt)

	return { prompt, systemPrompt: promptsConfig.system }
}

const PROMPTS_CONFIGS = {
	fix: FIX_CONFIG,
	edit: EDIT_CONFIG,
	gen: GEN_CONFIG
}

/**

View on GitHub (pinned to e474e8803c)

Solutions

  1. Use the fix flow only for backend languages (Python, TypeScript/deno, Go, etc.); fix frontend code manually in the editor.
  2. Switch the script to a supported backend language if an AI fix is essential.
  3. If product support is needed, request wiring a frontend fix prompt template instead of triggering the unsupported path.
  4. For frontend errors, paste the code and error into the AI chat manually rather than the structured fix action.

Example fix

// before
await fixScriptError({ type: 'fix', language: 'frontend', code, error })
// after
if (language === 'frontend') {
  // fall back to manual chat: build a plain prompt instead
  await askCopilot(`Fix this frontend code: ${error}\n${code}`)
} else {
  await fixScriptError({ type: 'fix', language, code, error })
}
Defensive patterns

Strategy: type-guard

Validate before calling

function isFixableLanguage(opts: { type: string; language?: string }): boolean {
  return opts.type !== 'fix' || opts.language !== 'frontend'
}

Type guard

function canAiFix(opts: { type: string; language?: string }): opts is { type: 'fix'; language: Exclude<string, 'frontend'> } {
  return !(opts.type === 'fix' && opts.language === 'frontend')
}

Try / catch

try {
  await buildFixPrompt(scriptOptions)
} catch (e) {
  if (e.message === 'Fixing frontend code is not supported') {
    showToast('AI fix is available for backend scripts only')
  } else throw e
}

Prevention

When it happens

Trigger: Invoking the AI 'fix error' action on a frontend/bruniro script — e.g. a script/flow step of type frontend whose last run produced an error and the user clicked the AI-fix entry point.

Common situations: User expects the same 'fix with AI' button available on Python/Go scripts to appear for frontend scripts; an automation or CLI flow passing type:'fix' with a frontend-language script.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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