windmill-labs/windmill · warning

'/wmill.d.ts' is generated automatically. Edit backend runna

Error message

'/wmill.d.ts' is generated automatically. Edit backend runnables instead.

What it means

In the app-edit copilot's applyPatch tool, paths under /wmill.d.ts are rejected because that file is generated automatically from backend runnables. The error tells the model/developer to edit backend runnables (backend/<key>/main.ts|py) instead; the .d.ts is regenerated from them, so hand-edits would be overwritten.

Source

Thrown at frontend/src/lib/components/copilot/chat/app/core.ts:608

		streamArguments: true,
		showDetails: true,
		showFade: true
	},
	{
		def: getPatchFileToolDef(),
		streamArguments: true,
		showDetails: true,
		showFade: true,
		fn: async ({ args, helpers, toolId, toolCallbacks }) => {
			const parsedArgs = getPatchFileSchema().parse(args)
			const { old_string: oldString, new_string: newString, replace_all: replaceAll } = parsedArgs
			const target = resolveAppPatchTarget(parsedArgs.path)
			let currentContent = ''
			let backendRunnable: BackendRunnable | undefined

			if (target.type === 'frontend') {
				if (target.path === '/wmill.d.ts') {
					throw new Error(
						"'/wmill.d.ts' is generated automatically. Edit backend runnables instead."
					)
				}

				const frontendContent = helpers.getFrontendFile(target.path)
				if (frontendContent === undefined) {
					throw new Error(`Frontend file '${target.path}' not found.`)
				}
				currentContent = frontendContent
			} else {
				backendRunnable = helpers.getBackendRunnable(target.key)
				if (!backendRunnable) {
					throw new Error(`Backend runnable '${target.key}' not found.`)
				}
				if (backendRunnable.type !== 'inline' || !backendRunnable.inlineScript) {
					throw new Error(
						`'${target.path}' points to backend runnable '${target.key}', but only inline runnables can be patched as files.`
					)

View on GitHub (pinned to e474e8803c)

Solutions

  1. Patch the backend runnable source instead: backend/<key>/main.ts or backend/<key>/main.py — the .d.ts regenerates from it
  2. If extra frontend types are needed, put them in a normal frontend file (e.g. /types.ts) rather than wmill.d.ts
  3. Adjust the model prompt/system instructions to state that /wmill.d.ts is read-only generated output

Example fix

// before
patchFile('/wmill.d.ts', '...custom typings...')
// after
patchFile('backend/runnable_key/main.ts', '...fix source so typings regenerate...')
Defensive patterns

Strategy: validation

Validate before calling

if (path.replace(/^\//, '') === 'wmill.d.ts') {
  throw new Error('wmill.d.ts is generated; edit backend runnables instead')
}

Type guard

function isGeneratedTypings(path: string): boolean {
  return path.replace(/^\//, '') === 'wmill.d.ts'
}

Try / catch

try {
  await patchTool({ path, content })
} catch (e) {
  if (e instanceof Error && e.message.includes('wmill.d.ts')) {
    toolCallbacks.report('wmill.d.ts is generated; patch the owning backend runnable instead')
    return
  }
  throw e
}

Prevention

When it happens

Trigger: The AI model issues an app patch with path '/wmill.d.ts' (or '/wmill.d.ts' trimmed) and resolveAppPatchTarget classifies it as a frontend file; happens when the model tries to fix type errors by editing the generated typings directly.

Common situations: Model confusion after seeing wmill.d.ts type errors in diagnostics; prompts that mention the generated file; a model attempting to add custom type declarations for frontend use.

Related errors


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