{"record":{"id":"f9fdfd7c70cb44b5","repo":"windmill-labs/windmill","slug":"target-path-points-to-backend-runnable-tar","errorCode":null,"errorMessage":"'${target.path}' points to backend runnable '${target.key}', but only inline runnables can be patched as files.","messagePattern":"'(.+?)' points to backend runnable '(.+?)', but only inline runnables can be patched as files\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/copilot/chat/app/core.ts","lineNumber":624,"sourceCode":"\t\t\tif (target.type === 'frontend') {\n\t\t\t\tif (target.path === '/wmill.d.ts') {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\"'/wmill.d.ts' is generated automatically. Edit backend runnables instead.\"\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\tconst frontendContent = helpers.getFrontendFile(target.path)\n\t\t\t\tif (frontendContent === undefined) {\n\t\t\t\t\tthrow new Error(`Frontend file '${target.path}' not found.`)\n\t\t\t\t}\n\t\t\t\tcurrentContent = frontendContent\n\t\t\t} else {\n\t\t\t\tbackendRunnable = helpers.getBackendRunnable(target.key)\n\t\t\t\tif (!backendRunnable) {\n\t\t\t\t\tthrow new Error(`Backend runnable '${target.key}' not found.`)\n\t\t\t\t}\n\t\t\t\tif (backendRunnable.type !== 'inline' || !backendRunnable.inlineScript) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`'${target.path}' points to backend runnable '${target.key}', but only inline runnables can be patched as files.`\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\tconst expectedExtension = getBackendInlineScriptExtension(backendRunnable)\n\t\t\t\tif (target.extension !== expectedExtension) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`'${target.path}' does not match runnable '${target.key}' language. Use backend/${target.key}/main.${expectedExtension}.`\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\tcurrentContent = backendRunnable.inlineScript.content ?? ''\n\t\t\t}\n\n\t\t\tconst updatedContent = findAndReplace(\n\t\t\t\tcurrentContent,\n\t\t\t\toldString,\n\t\t\t\tnewString,","sourceCodeStart":606,"sourceCodeEnd":642,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/chat/app/core.ts#L606-L642","documentation":"Backend runnables can only be patched as files when they are inline scripts (with inlineScript content). Runnables that reference an external path/path-based script or lack inline content cannot be text-patched, so applyPatch throws this error naming both the path and the runnable key. It prevents corrupting a runnable whose source lives outside the app file.","triggerScenarios":"Patching 'backend/<key>/main.ts' where getBackendRunnable(key) exists but its type is not 'inline' or inlineScript is undefined — e.g. the runnable points to a script by path, is a hub/flow reference, or the inline script body was never set.","commonSituations":"Apps whose steps are reused scripts stored in the script library (path-referenced) rather than inline code; converted apps; model assuming every backend step is editable inline.","solutions":["Open the referenced script by its path in the script editor and edit it there instead of patching the app file","Convert the runnable to an inline script if the app design allows, then patch it","Choose a different backend runnable that is inline, or add a new inline runnable for the change"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"const r = helpers.getBackendRunnable(key)\nif (r && (r.type !== 'inline' || !r.inlineScript)) {\n  throw new Error(`Runnable ${key} is not inline; edit its referenced script by path instead`)\n}","typeGuard":"function isInlineRunnable(r: BackendRunnable | undefined): r is BackendRunnable & { type: 'inline'; inlineScript: NonNullable<BackendRunnable['inlineScript']> } {\n  return !!r && r.type === 'inline' && !!r.inlineScript\n}","tryCatchPattern":"try {\n  await patchTool({ path, ... })\n} catch (e) {\n  if (e instanceof Error && e.message.includes('only inline runnables can be patched')) {\n    toolCallbacks.report('Open the referenced script in the script editor to change it')\n    return\n  }\n  throw e\n}","preventionTips":["Check runnable.type === 'inline' before offering file-based patching","Keep reusable steps as inline scripts if the workflow expects AI edits","Surface referenced script paths in file listings so the model targets the real source"],"tags":["copilot","app-editor","unsupported-operation"],"backgroundTag":"non-editable-generated-resource","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"}