{"record":{"id":"63a9c93464cd4f46","repo":"windmill-labs/windmill","slug":"unresolved-inline-script-reference-s-refs-a","errorCode":null,"errorMessage":"Unresolved inline script reference(s): ${refs}. A rawscript \"content\" placeholder must be \"inline_script.<its own module id>\" (a new body, filled afterwards with the set-module-code tool) or reference an existing rawscript module to keep its current body. Nothing was saved.","messagePattern":"Unresolved inline script reference\\(s\\): (.+?)\\. A rawscript \"content\" placeholder must be \"inline_script\\.<its own module id>\" \\(a new body, filled afterwards with the set-module-code tool\\) or reference an existing rawscript module to keep its current body\\. Nothing was saved\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/copilot/chat/flow/editableFlowJson.ts","lineNumber":553,"sourceCode":" */\nexport function finalizeUnresolvedInlineScripts(value: {\n\tmodules: FlowModule[]\n\tpreprocessor_module?: FlowModule | null\n\tfailure_module?: FlowModule | null\n}): void {\n\tconst specials = [value.preprocessor_module, value.failure_module].filter(\n\t\t(module): module is FlowModule => module != null\n\t)\n\tconst blanked = new Set<string>()\n\treplaceNewInlineScriptRefsWithEmptyCode(value.modules, blanked)\n\treplaceNewInlineScriptRefsWithEmptyCode(specials, blanked)\n\tconst unresolved = [\n\t\t...findUnresolvedInlineScriptRefs(value.modules),\n\t\t...findUnresolvedInlineScriptRefs(specials)\n\t]\n\tif (unresolved.length > 0) {\n\t\tconst refs = unresolved.map((id) => `\"inline_script.${id}\"`).join(', ')\n\t\tthrow new Error(\n\t\t\t`Unresolved inline script reference(s): ${refs}. A rawscript \"content\" placeholder must be \"inline_script.<its own module id>\" (a new body, filled afterwards with the set-module-code tool) or reference an existing rawscript module to keep its current body. Nothing was saved.`\n\t\t)\n\t}\n}\n","sourceCodeStart":535,"sourceCodeEnd":558,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/chat/flow/editableFlowJson.ts#L535-L558","documentation":"finalizeUnresolvedInlineScripts (called from resolveWriteFlowInlineScripts and patchFlowJson) scans the flow for rawscript 'content' fields left as 'inline_script.<id>' placeholders. If any placeholder cannot be resolved — either filled with a real body via the set-module-code tool, or pointing at an existing rawscript module to copy its content — the whole save is aborted ('Nothing was saved') so no flow with placeholder code is persisted.","triggerScenarios":"Calling patchFlowJson / resolveWriteFlowInlineScripts while some rawscript module still has content equal to an 'inline_script.<id>' reference that was never resolved: the referenced id doesn't exist, isn't a rawscript module, or set-module-code was never called for it.","commonSituations":"LLM emits a flow plan with placeholder bodies but the follow-up set-module-code calls fail or are skipped; a typo in the inline_script reference id; referencing a non-rawscript module's id; user stops the agent mid-write.","solutions":["Call the set-module-code tool with the actual code for every listed inline_script.<id> reference","If the reference was meant to reuse an existing module's body, point content's inline_script.<id> at an existing rawscript module id","Replace content with the literal script body (no placeholder) and retry the write","Fix the id typo in the inline_script reference and re-save"],"exampleFix":"// before\n{ type: 'rawscript', content: 'inline_script.transform_data' } // never filled\n// after (via set-module-code tool)\n{ type: 'rawscript', content: 'def main(x):\\n    return x * 2' }","handlingStrategy":"validation","validationCode":"const all = [...modules, preprocessor, failure].filter(Boolean)\nconst bad = all.filter(m =>\n  m?.value?.type === 'rawscript' && /^inline_script\\./.test(m.value.content ?? ''))\nif (bad.length) throw new Error('unfilled inline_script placeholders: ' + bad.map(m => m.id).join(', '))","typeGuard":"function hasResolvedInlineScripts(flow) {\n  const check = (mods) => (mods ?? []).every(m =>\n    m?.value?.type !== 'rawscript' || !m.value.content?.startsWith('inline_script.'))\n  return check(flow.modules) && check([flow.preprocessor_module, flow.failure_module].filter(Boolean))\n}","tryCatchPattern":"try {\n  await patchFlowJson(json, args)\n} catch (e) {\n  if (e.message.includes('Unresolved inline script reference(s)')) {\n    const ids = [...e.message.matchAll(/\"inline_script\\.([^\"]+)\"/g)].map(m => m[1])\n    for (const id of ids) await setModuleCode(id, resolveBody(id))\n    await patchFlowJson(json, args) // retry\n  } else throw e\n}","preventionTips":["After emitting inline_script.<id> placeholders, always call set-module-code for each id before saving","Verify placeholder ids point at real rawscript module ids (exact match)","Keep a checklist of emitted placeholders and confirm each is resolved before patchFlowJson","If reuse of an existing body was intended, reference an existing rawscript module id, not a new one"],"tags":["validation","flow","placeholder","rawscript"],"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"}