{"record":{"id":"7d77ce0531c56cef","repo":"windmill-labs/windmill","slug":"path-is-required-when-runnable-type-is-script","errorCode":null,"errorMessage":"path is required when runnable type is \"script\", \"flow\", or \"hubscript\".","messagePattern":"path is required when runnable type is \"script\", \"flow\", or \"hubscript\"\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/copilot/chat/global/core.ts","lineNumber":1644,"sourceCode":"\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,\n\t\tname: input.name,\n\t\ttype: 'path',\n\t\trunType: input.type,\n\t\tpath: input.path,\n\t\tfields,\n\t\tschema: sameTarget ? (existing?.schema ?? {}) : {}\n\t}\n}\n\ntype AppFrontendFileMetadata = {\n\tpath: string\n\tsize: number\n}\n\ntype AppBackendRunnableMetadata = {","sourceCodeStart":1626,"sourceCodeEnd":1662,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/chat/global/core.ts#L1626-L1662","documentation":"The path-based runnable branch (type \"script\", \"flow\", or \"hubscript\") requires a `path` pointing at the referenced runnable. When none of those types carry a path, core.ts throws this error. It is the mirror of error 366 for the by-path variants.","triggerScenarios":"Calling the runnable tool with { type: 'script', name: 'x' } and no path, or with path set to empty string/null; copying a runType without carrying the path field over.","commonSituations":"The AI omits path when switching from an inline runnable to a by-path one; the path variable is undefined because a lookup step failed; a typo leaves path undefined while runType is set.","solutions":["Add the path of the target script/flow/hub script, e.g. path: 'u/admin/my_script'.","If no path exists yet, use type \"inline\" with inlineScript content instead.","Confirm the referenced item exists with a workspace-item search/list before referencing it.","Guard the input: only choose a path-based type when a non-empty path string is available."],"exampleFix":"// before\nrunnable({ type: 'script', name: 'transform' })\n// after\nrunnable({ type: 'script', name: 'transform', path: 'u/admin/transform' })","handlingStrategy":"validation","validationCode":"if (['script', 'flow', 'hubscript'].includes(input.type) && !input.path) {\n  throw new Error(`path required for type ${input.type}`)\n}","typeGuard":"function hasPath(i: RunnableInput): i is RunnableInput & { path: string } {\n  return i.type === 'inline' || typeof (i as any).path === 'string' && (i as any).path.length > 0\n}","tryCatchPattern":"try {\n  await createRunnable(input)\n} catch (e) {\n  if (e.message.includes('path is required')) {\n    const found = await findWorkspaceItem(input.type, input.name)\n    await createRunnable({ ...input, path: found.path })\n  }\n}","preventionTips":["Resolve the workspace item's path before choosing a path-based runnable type","Treat empty-string path as missing — check truthiness, not just presence","Fall back to type:\"inline\" with content when no path exists"],"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"}