{"record":{"id":"ddc03ed67854d0b7","repo":"windmill-labs/windmill","slug":"unresolved-inline-script-references-unresolvedr","errorCode":null,"errorMessage":"Unresolved inline script references: ${unresolvedRefs.join(', ')}","messagePattern":"Unresolved inline script references: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/copilot/chat/flow/helperUtils.ts","lineNumber":357,"sourceCode":"\nfunction restoreFlowModule(\n\tmodule: FlowModule,\n\tinlineScriptSession: InlineScriptSession,\n\temptyInlineScriptModuleIds: Set<string>\n): FlowModule {\n\tconst [restoredModule] = inlineScriptSession.restoreInlineScriptReferences([module])\n\treplaceNewInlineScriptRefsWithEmptyCode([restoredModule], emptyInlineScriptModuleIds)\n\tassertResolvedInlineScripts([restoredModule], inlineScriptSession)\n\treturn restoredModule\n}\n\nfunction assertResolvedInlineScripts(\n\tmodules: FlowModule[],\n\tinlineScriptSession: InlineScriptSession\n): void {\n\tconst unresolvedRefs = inlineScriptSession.findUnresolvedInlineScriptRefs(modules)\n\tif (unresolvedRefs.length > 0) {\n\t\tthrow new Error(`Unresolved inline script references: ${unresolvedRefs.join(', ')}`)\n\t}\n}\n\nexport function replaceNewInlineScriptRefsWithEmptyCode(\n\tmodules: FlowModule[],\n\temptyInlineScriptModuleIds: Set<string>\n): void {\n\tfunction replaceInlineScriptRefWithEmptyCode(ownerId: string, content: string): string {\n\t\tconst match = content.match(/^inline_script\\.(.+)$/)\n\t\tif (!match || match[1] !== ownerId) {\n\t\t\treturn content\n\t\t}\n\n\t\temptyInlineScriptModuleIds.add(ownerId)\n\t\treturn ''\n\t}\n\n\tforEachFlowModule(modules, (module) => {","sourceCodeStart":339,"sourceCodeEnd":375,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/chat/flow/helperUtils.ts#L339-L375","documentation":"assertResolvedInlineScripts runs when restoring flow modules from an inline-script editing session. During the session, module code may contain placeholder references to inline scripts that the session promised to materialize. If findUnresolvedInlineScriptRefs still finds placeholders in the final modules, restore is aborted with this error listing the unresolved refs.","triggerScenarios":"Calling restoreFlowModules/restoreFlowModule while modules still contain inline-script placeholder refs that were never given code in the session — e.g. a session created a placeholder module but set_flow_module_code was never called for it before restore.","commonSituations":"The AI agent's restore step ran before all code-fill steps completed; a module was added with a placeholder mid-session and then the flow was restored without finishing it; an error in an earlier tool call skipped the code-fill step.","solutions":["Complete the session: call set_flow_module_code with the final code for every placeholder module before restoring.","Replace remaining placeholder refs with real script paths or inline code in the modules.","If the module is not needed, remove it from the modules array before restore.","Check the listed refs in the error against the modules to find which module still carries the placeholder."],"exampleFix":"// before\nrestoreFlowModules(modulesWithPlaceholders, session) // throws\n// after\nsetFlowModuleCode(session, moduleId, finalCode)\nrestoreFlowModules(modulesWithPlaceholders, session)","handlingStrategy":"try-catch","validationCode":"const unresolved = inlineScriptSession.findUnresolvedInlineScriptRefs(modules)\nif (unresolved.length > 0) {\n  throw new Error(`resolve before restore: ${unresolved.join(', ')}`)\n}","typeGuard":"null","tryCatchPattern":"try {\n  restoreFlowModules(modules, session)\n} catch (e) {\n  if (e.message.startsWith('Unresolved inline script references')) {\n    for (const ref of e.message.slice('Unresolved inline script references: '.length).split(', ')) {\n      await setFlowModuleCode(session, refToModuleId(ref), placeholderBody)\n    }\n    restoreFlowModules(modules, session)\n  }\n}","preventionTips":["Call set_flow_module_code for every placeholder created during the session before restoring","Check findUnresolvedInlineScriptRefs yourself before restore","Keep module creation and code-fill steps adjacent so none is skipped on error"],"tags":["state","inline-scripts","flow","ai-tools"],"backgroundTag":"unresolved-placeholder","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"}