{"record":{"id":"b2205f277ac4f3e4","repo":"windmill-labs/windmill","slug":"inlinescript-is-required-when-runnable-type-is-in","errorCode":null,"errorMessage":"inlineScript is required when runnable type is \"inline\".","messagePattern":"inlineScript is required when runnable type is \"inline\"\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/copilot/chat/global/core.ts","lineNumber":1629,"sourceCode":"\t\t: (existing?.fields ?? {})\n\n\t// Converting between kinds must drop the other kind's fields. Every consumer dispatches on\n\t// `type` (isRunnableByName / isRunnableByPath), so a leftover does not change which code\n\t// runs — it contradicts it: a runnable reported back as inline still names a flow in\n\t// `path`, and that is what the model reads on its next turn.\n\tconst { runType: _runType, path: _path, inlineScript: _inlineScript, ...carried } = existing ?? {}\n\n\t// `schema` describes the item a path runnable points at, so it only survives while that\n\t// target is unchanged. Carried across a retarget it types `backend.<key>(args)` from the\n\t// previous item's inputs, because hiddenRunnableToTsType reads it for the path branch.\n\tconst sameTarget =\n\t\t(existing?.type === 'path' || existing?.type === 'runnableByPath') &&\n\t\texisting?.runType === input.type &&\n\t\texisting?.path === input.path\n\n\tif (input.type === 'inline') {\n\t\tif (!input.inlineScript) {\n\t\t\tthrow new Error('inlineScript is required when runnable type is \"inline\".')\n\t\t}\n\t\treturn {\n\t\t\t...carried,\n\t\t\tname: input.name,\n\t\t\ttype: 'inline',\n\t\t\tinlineScript: {\n\t\t\t\tcontent: input.inlineScript.content,\n\t\t\t\tlanguage: input.inlineScript.language\n\t\t\t},\n\t\t\tfields\n\t\t}\n\t}\n\n\tif (!input.path) {\n\t\tthrow new Error('path is required when runnable type is \"script\", \"flow\", or \"hubscript\".')\n\t}\n\treturn {\n\t\t...carried,","sourceCodeStart":1611,"sourceCodeEnd":1647,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/chat/global/core.ts#L1611-L1647","documentation":"When building a persisted runnable reference for an app backend module, the type:\"inline\" branch requires an `inlineScript` payload (the actual script content). If type is \"inline\" but inlineScript is missing, core.ts throws this error instead of producing an invalid runnable.","triggerScenarios":"Calling the runnable-creating tool with { type: 'inline', name: '...' } but omitting inlineScript; inlineScript was null/undefined because a previous step that was supposed to supply the script body did not run.","commonSituations":"The AI drops the inlineScript field when generating tool args; the caller intends to reference a script by path but sets type to \"inline\" by mistake; an optional-script param defaulted to undefined.","solutions":["Provide inlineScript with the script content when type is \"inline\".","If you meant to reference an existing script, use type \"script\" (or \"flow\"/\"hubscript\") with a path instead.","Check that the upstream step producing the script body actually succeeded and its value is defined.","Validate the input object has inlineScript before calling the tool."],"exampleFix":"// before\nrunnable({ type: 'inline', name: 'fetch' })\n// after\nrunnable({ type: 'inline', name: 'fetch', inlineScript: { language: 'python3', content: '...' } })","handlingStrategy":"validation","validationCode":"if (input.type === 'inline' && !input.inlineScript) {\n  throw new Error('provide inlineScript for inline runnables')\n}","typeGuard":"function isInlineRunnable(i: RunnableInput): i is RunnableInput & { inlineScript: object } {\n  return i.type !== 'inline' || (i as any).inlineScript != null\n}","tryCatchPattern":"try {\n  await createRunnable(input)\n} catch (e) {\n  if (e.message.includes('inlineScript is required')) {\n    await createRunnable({ ...input, type: 'script', path: existingScriptPath })\n  }\n}","preventionTips":["Always pair type:\"inline\" with a non-empty inlineScript payload","Use a path-based type when you only want to reference an existing script","Validate tool inputs with the provided zod schemas before dispatch"],"tags":["validation","missing-argument","apps","ai-tools"],"backgroundTag":"missing-required-argument","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"}