windmill-labs/windmill · error
Frontend file "${target.filePath}" not found in app "${path}
Error message
Frontend file "${target.filePath}" not found in app "${path}". What it means
Thrown when reading a file's content as part of an edit/overwrite operation: for frontend targets, the draft's `files` map has no entry under target.filePath, so there is no current content to base the edit on. The tool refuses to proceed rather than silently creating a file.
Source
Thrown at frontend/src/lib/components/copilot/chat/global/core.ts:5891
replace_all: replaceAll
} = args
const target = resolveAppFileTarget(filePath)
if (target.kind === 'frontend') {
assertNotGeneratedAppFile(target.filePath)
}
toolCallbacks.setToolStatus(toolId, {
content: `Patching ${target.filePath} in app "${path}"...`
})
const { value } = await loadAppDraftValue(path, workspace)
let currentContent: string
let runnable: PersistedRunnable | undefined
if (target.kind === 'frontend') {
const existing = value.files[target.filePath]
if (existing === undefined) {
throw new Error(`Frontend file "${target.filePath}" not found in app "${path}".`)
}
currentContent = existing
} else {
const resolved = getInlineRunnableContent(value, target, path)
currentContent = resolved.content
runnable = resolved.runnable
}
const updated = findAndReplace(
currentContent,
oldString,
newString,
replaceAll,
`${target.filePath} content`
)
if (target.kind === 'frontend') {
value.files = { ...value.files, [target.filePath]: updated }View on GitHub (pinned to e474e8803c)
Solutions
- List the app's actual frontend files and retry with an existing path
- If the intent is to create a new file, use a create/write tool rather than an edit tool
- Check path casing and app-relative path format
Example fix
// before
edit_app_file({ path: 'f/app_main', file_path: 'src/Header.svelte', ... }) // missing
// after
write_app_file({ path: 'f/app_main', file_path: 'src/Header.svelte', content: '...' }) Defensive patterns
Strategy: validation
Validate before calling
const { value } = await loadAppDraftValue(path, workspace)
const existing = value.files[target.filePath]
if (existing === undefined) {
// use a create/write tool instead of an edit tool
} Type guard
function hasFile(files: Record<string, string>, p: string): boolean {
return p in files
} Try / catch
try {
await editAppFile(args)
} catch (e) {
if (e instanceof Error && e.message.includes('not found in app')) {
await writeAppFile({ path: args.path, file_path: args.file_path, content: newContent })
}
} Prevention
- Check existence before choosing edit vs create
- Re-read the draft after other tools may have renamed/removed the file
When it happens
Trigger: An edit/patch-style tool call (one that reads current content before writing) targets a frontend file that is absent from the app draft — wrong path, deleted file, or file that only exists in the deployed version.
Common situations: Model edits a file it saw in the deployed app but that was renamed/removed in the draft; path casing mismatch; the file was never created and an edit tool was used instead of a create tool.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- write_app_file only writes frontend files. Use write_app_run
- delete_app_file only deletes frontend files. Use delete_app_
- App "${path}" has no backend runnable "${key}". Available ru
- Backend runnable "${key}" not found in app "${path}".
- File not found: ${filePath}
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/faac5910a7c42ff5.
Report an issue: GitHub.