windmill-labs/windmill · error
Unresolved inline script reference(s): ${refs}. A rawscript
Error message
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. What it means
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.
Source
Thrown at frontend/src/lib/components/copilot/chat/flow/editableFlowJson.ts:553
*/
export function finalizeUnresolvedInlineScripts(value: {
modules: FlowModule[]
preprocessor_module?: FlowModule | null
failure_module?: FlowModule | null
}): void {
const specials = [value.preprocessor_module, value.failure_module].filter(
(module): module is FlowModule => module != null
)
const blanked = new Set<string>()
replaceNewInlineScriptRefsWithEmptyCode(value.modules, blanked)
replaceNewInlineScriptRefsWithEmptyCode(specials, blanked)
const unresolved = [
...findUnresolvedInlineScriptRefs(value.modules),
...findUnresolvedInlineScriptRefs(specials)
]
if (unresolved.length > 0) {
const refs = unresolved.map((id) => `"inline_script.${id}"`).join(', ')
throw new Error(
`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.`
)
}
}
View on GitHub (pinned to e474e8803c)
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
Example fix
// before
{ type: 'rawscript', content: 'inline_script.transform_data' } // never filled
// after (via set-module-code tool)
{ type: 'rawscript', content: 'def main(x):\n return x * 2' } Defensive patterns
Strategy: validation
Validate before calling
const all = [...modules, preprocessor, failure].filter(Boolean)
const bad = all.filter(m =>
m?.value?.type === 'rawscript' && /^inline_script\./.test(m.value.content ?? ''))
if (bad.length) throw new Error('unfilled inline_script placeholders: ' + bad.map(m => m.id).join(', ')) Type guard
function hasResolvedInlineScripts(flow) {
const check = (mods) => (mods ?? []).every(m =>
m?.value?.type !== 'rawscript' || !m.value.content?.startsWith('inline_script.'))
return check(flow.modules) && check([flow.preprocessor_module, flow.failure_module].filter(Boolean))
} Try / catch
try {
await patchFlowJson(json, args)
} catch (e) {
if (e.message.includes('Unresolved inline script reference(s)')) {
const ids = [...e.message.matchAll(/"inline_script\.([^"]+)"/g)].map(m => m[1])
for (const id of ids) await setModuleCode(id, resolveBody(id))
await patchFlowJson(json, args) // retry
} else throw e
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Cannot push flow ${remotePath}: step(s) reference non-worksp
- Module value is undefined for module ${module.id}
- Invalid AI agent provider configuration: ${errors.join('\n')
- Invalid ${field}:\n${errors.join('\n')}
- Invalid ${field}: id must be "${expectedId}"
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/63a9c93464cd4f46.
Report an issue: GitHub.