{"record":{"id":"b19fb7f77f16521f","repo":"windmill-labs/windmill","slug":"fixing-frontend-code-is-not-supported","errorCode":null,"errorMessage":"Fixing frontend code is not supported","messagePattern":"Fixing frontend code is not supported","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"frontend/src/lib/components/copilot/lib.ts","lineNumber":864,"sourceCode":"\t\t}\n\t}\n\treturn prompt\n}\n\nasync function getPrompts(scriptOptions: CopilotOptions) {\n\tconst promptsConfig = PROMPTS_CONFIGS[scriptOptions.type]\n\tlet prompt = promptsConfig.prompts[scriptOptions.language].prompt\n\tif (scriptOptions.type !== 'fix') {\n\t\tprompt = prompt.replace('{description}', scriptOptions.description)\n\t}\n\n\tif (scriptOptions.type !== 'gen') {\n\t\tprompt = prompt.replace('{code}', scriptOptions.code)\n\t}\n\n\tif (scriptOptions.type === 'fix') {\n\t\tif (scriptOptions.language === 'frontend') {\n\t\t\tthrow new Error('Fixing frontend code is not supported')\n\t\t}\n\t\tprompt = prompt.replace('{error}', scriptOptions.error)\n\t}\n\n\tprompt = await addResourceTypes(scriptOptions, prompt)\n\n\tprompt = addDBSChema(scriptOptions, prompt)\n\n\treturn { prompt, systemPrompt: promptsConfig.system }\n}\n\nconst PROMPTS_CONFIGS = {\n\tfix: FIX_CONFIG,\n\tedit: EDIT_CONFIG,\n\tgen: GEN_CONFIG\n}\n\n/**","sourceCodeStart":846,"sourceCodeEnd":882,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/lib.ts#L846-L882","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use the fix flow only for backend languages (Python, TypeScript/deno, Go, etc.); fix frontend code manually in the editor.","Switch the script to a supported backend language if an AI fix is essential.","If product support is needed, request wiring a frontend fix prompt template instead of triggering the unsupported path.","For frontend errors, paste the code and error into the AI chat manually rather than the structured fix action."],"exampleFix":"// before\nawait fixScriptError({ type: 'fix', language: 'frontend', code, error })\n// after\nif (language === 'frontend') {\n  // fall back to manual chat: build a plain prompt instead\n  await askCopilot(`Fix this frontend code: ${error}\\n${code}`)\n} else {\n  await fixScriptError({ type: 'fix', language, code, error })\n}","handlingStrategy":"type-guard","validationCode":"function isFixableLanguage(opts: { type: string; language?: string }): boolean {\n  return opts.type !== 'fix' || opts.language !== 'frontend'\n}","typeGuard":"function canAiFix(opts: { type: string; language?: string }): opts is { type: 'fix'; language: Exclude<string, 'frontend'> } {\n  return !(opts.type === 'fix' && opts.language === 'frontend')\n}","tryCatchPattern":"try {\n  await buildFixPrompt(scriptOptions)\n} catch (e) {\n  if (e.message === 'Fixing frontend code is not supported') {\n    showToast('AI fix is available for backend scripts only')\n  } else throw e\n}","preventionTips":["Hide the AI-fix action for frontend-language scripts in the UI.","Feature-check language support before offering fix entry points.","Route frontend errors through the general AI chat instead."],"tags":["unsupported-feature","frontend","copilot","limitations"],"backgroundTag":"unsupported-operation","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}