{"record":{"id":"faac5910a7c42ff5","repo":"windmill-labs/windmill","slug":"frontend-file-target-filepath-not-found-in-ap-faac59","errorCode":null,"errorMessage":"Frontend file \"${target.filePath}\" not found in app \"${path}\".","messagePattern":"Frontend file \"(.+?)\" not found in app \"(.+?)\"\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/copilot/chat/global/core.ts","lineNumber":5891,"sourceCode":"\t\treplace_all: replaceAll\n\t} = args\n\tconst target = resolveAppFileTarget(filePath)\n\tif (target.kind === 'frontend') {\n\t\tassertNotGeneratedAppFile(target.filePath)\n\t}\n\n\ttoolCallbacks.setToolStatus(toolId, {\n\t\tcontent: `Patching ${target.filePath} in app \"${path}\"...`\n\t})\n\n\tconst { value } = await loadAppDraftValue(path, workspace)\n\tlet currentContent: string\n\tlet runnable: PersistedRunnable | undefined\n\n\tif (target.kind === 'frontend') {\n\t\tconst existing = value.files[target.filePath]\n\t\tif (existing === undefined) {\n\t\t\tthrow new Error(`Frontend file \"${target.filePath}\" not found in app \"${path}\".`)\n\t\t}\n\t\tcurrentContent = existing\n\t} else {\n\t\tconst resolved = getInlineRunnableContent(value, target, path)\n\t\tcurrentContent = resolved.content\n\t\trunnable = resolved.runnable\n\t}\n\n\tconst updated = findAndReplace(\n\t\tcurrentContent,\n\t\toldString,\n\t\tnewString,\n\t\treplaceAll,\n\t\t`${target.filePath} content`\n\t)\n\n\tif (target.kind === 'frontend') {\n\t\tvalue.files = { ...value.files, [target.filePath]: updated }","sourceCodeStart":5873,"sourceCodeEnd":5909,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/chat/global/core.ts#L5873-L5909","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nedit_app_file({ path: 'f/app_main', file_path: 'src/Header.svelte', ... }) // missing\n// after\nwrite_app_file({ path: 'f/app_main', file_path: 'src/Header.svelte', content: '...' })","handlingStrategy":"validation","validationCode":"const { value } = await loadAppDraftValue(path, workspace)\nconst existing = value.files[target.filePath]\nif (existing === undefined) {\n  // use a create/write tool instead of an edit tool\n}","typeGuard":"function hasFile(files: Record<string, string>, p: string): boolean {\n  return p in files\n}","tryCatchPattern":"try {\n  await editAppFile(args)\n} catch (e) {\n  if (e instanceof Error && e.message.includes('not found in app')) {\n    await writeAppFile({ path: args.path, file_path: args.file_path, content: newContent })\n  }\n}","preventionTips":["Check existence before choosing edit vs create","Re-read the draft after other tools may have renamed/removed the file"],"tags":["ai-agent","file-not-found","app-editing"],"backgroundTag":"file-not-found","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"}