{"record":{"id":"f156222c0ad3dae3","repo":"windmill-labs/windmill","slug":"a-script-already-exists-at-path-use-edit-pip","errorCode":null,"errorMessage":"A script already exists at '${path}'. Use edit_pipeline_node to change it instead.","messagePattern":"A script already exists at '(.+?)'\\. Use edit_pipeline_node to change it instead\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/assets/AssetGraph/pipelineAiHelpers.ts","lineNumber":263,"sourceCode":"\t\t\t\tthrow new Error(\n\t\t\t\t\t`A pipeline node already exists at '${path}'. Use edit_pipeline_node to change it instead.`\n\t\t\t\t)\n\t\t\t}\n\t\t\t// Authoritative new-node check: the resolved graph may not have hydrated yet\n\t\t\t// (the session preview can race open_preview), and it only lists pipeline\n\t\t\t// runnables — so probe the backend. ANY deployed script at this path means\n\t\t\t// \"build new\" would shadow it on deploy; the model should edit instead.\n\t\t\tconst workspace = deps.getWorkspace()\n\t\t\tif (workspace) {\n\t\t\t\tlet deployedExists = false\n\t\t\t\ttry {\n\t\t\t\t\tawait ScriptService.getScriptByPath({ workspace, path })\n\t\t\t\t\tdeployedExists = true\n\t\t\t\t} catch {\n\t\t\t\t\t// 404 → no deployed script at this path, safe to create a new node.\n\t\t\t\t}\n\t\t\t\tif (deployedExists) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`A script already exists at '${path}'. Use edit_pipeline_node to change it instead.`\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst inferred = await inferDraftAssets(language, content)\n\t\t\t// Fall back to a seeded output (from the declared output_kind) when the\n\t\t\t// body doesn't yet write anything inferable.\n\t\t\tconst seeded =\n\t\t\t\tinferred.writes[0] ??\n\t\t\t\t(outputKind\n\t\t\t\t\t? autoOutputAsset(outputKind as PipelineOutputKind, folderName(), language)\n\t\t\t\t\t: undefined)\n\t\t\t// Effective outputs = what actually becomes an output edge on the canvas:\n\t\t\t// body/annotation-inferred writes, or the output_kind seed as a fallback.\n\t\t\tconst outputAssets =\n\t\t\t\tinferred.writes.length > 0 ? inferred.writes : seeded ? [seeded] : undefined\n\t\t\tconst next = new Map(drafts)\n\t\t\tnext.set(path, {","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/assets/AssetGraph/pipelineAiHelpers.ts#L245-L281","documentation":"Authoritative new-node check in pipelineAiHelpers proposeNode: the local graph may not have hydrated (it races open_preview and only lists pipeline runnables), so the backend is probed via getScriptByPath; any deployed script at that path means 'build new' would shadow it on deploy.","triggerScenarios":"Thrown at frontend/src/lib/components/assets/AssetGraph/pipelineAiHelpers.ts:263 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use edit_pipeline_node to modify the existing deployed script.","Choose a different path that is not already deployed."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}