{"record":{"id":"28333181dbaa79d7","repo":"windmill-labs/windmill","slug":"local-pathscript-filepath-requires-codebase-ass","errorCode":null,"errorMessage":"Local PathScript ${filePath} requires codebase assets, which flow preview/dev cannot inline yet","messagePattern":"Local PathScript (.+?) requires codebase assets, which flow preview/dev cannot inline yet","errorType":"exception","errorClass":"UnsupportedLocalPathScriptPreviewError","httpStatus":null,"severity":"error","filePath":"cli/src/utils/local_path_scripts.ts","lineNumber":75,"sourceCode":"    define: codebase.define,\n    loader: codebase.loader ?? { \".node\": \"file\" },\n    outdir: \"/\",\n    platform: \"node\",\n    packages: \"bundle\",\n    target: \"esnext\",\n    banner: codebase.banner,\n  });\n\n  if (out.outputFiles.length === 0) {\n    throw new Error(`No output files found for ${filePath}`);\n  }\n  if (out.outputFiles.length > 1) {\n    throw new UnsupportedLocalPathScriptPreviewError(\n      `Local PathScript ${filePath} requires a multi-file bundle, which flow preview/dev cannot inline yet`\n    );\n  }\n  if (Array.isArray(codebase.assets) && codebase.assets.length > 0) {\n    throw new UnsupportedLocalPathScriptPreviewError(\n      `Local PathScript ${filePath} requires codebase assets, which flow preview/dev cannot inline yet`\n    );\n  }\n\n  return out.outputFiles[0].text;\n}\n\nexport function createPreviewLocalScriptReader(opts: {\n  exts: string[];\n  defaultTs?: \"bun\" | \"deno\";\n  codebases: SyncCodebase[];\n}): (scriptPath: string) => Promise<LocalScriptInfo | undefined> {\n  return async (scriptPath) => {\n    const localScript = await resolvePreviewLocalScriptState(scriptPath, opts);\n    if (!localScript) {\n      return undefined;\n    }\n","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/utils/local_path_scripts.ts#L57-L93","documentation":"Also in bundleSingleFileCodebaseScript (cli/src/utils/local_path_scripts.ts): if the SyncCodebase declares assets (codebase.assets is a non-empty array), the bundled script cannot be inlined into flow preview/dev, which only supports single-file payloads, so UnsupportedLocalPathScriptPreviewError is thrown. Like the multi-file case, this is a declared preview limitation — deploy via sync works fine with assets.","triggerScenarios":"bundleSingleFileCodebaseScript is invoked during flow preview/dev for a bun PathScript whose matching codebase (found via findCodebase) has Array.isArray(codebase.assets) && codebase.assets.length > 0, regardless of the esbuild output itself.","commonSituations":"A codebase.yaml/folder declaring asset files (data files, native libs) alongside the script; sharing one codebase between a deployable script and a step inlined in flow preview; forgetting that preview/dev supports only inline single-file scripts; assets added recently to an existing codebase that previously previewed fine.","solutions":["Deploy via `wmill sync push` instead of flow preview/dev when the codebase has assets — assets are fully supported there","Remove the assets from the codebase if they are not needed for the previewed flow step","Split the asset-dependent script out of the flow into a separately deployed script and call it by path","Inline the asset content directly into the script source if it is small, eliminating the assets declaration"],"exampleFix":"// before: flow dev on a step whose codebase declares assets\ncodebase: { assets: [\"data.csv\"] }\nwmill flow dev flow.yaml // UnsupportedLocalPathScriptPreviewError\n\n// after: deploy the codebase script and reference it in the flow instead of inlining\nwmill sync push // script with assets deployed\n// flow step: path: f/scripts/asset_script instead of a local inline file","handlingStrategy":"validation","validationCode":"if (Array.isArray(codebase.assets) && codebase.assets.length > 0 && isFlowPreviewPath(scriptPath)) {\n  throw new Error(`${scriptPath}'s codebase declares ${codebase.assets.length} asset(s); flow preview/dev cannot inline them — deploy via 'wmill sync push'`);\n}","typeGuard":"function isUnsupportedPreviewError(err: unknown): err is import(\"./local_path_scripts.ts\").UnsupportedLocalPathScriptPreviewError {\n  return err instanceof Error && err.name === \"UnsupportedLocalPathScriptPreviewError\";\n}","tryCatchPattern":"import { UnsupportedLocalPathScriptPreviewError } from \"./utils/local_path_scripts.ts\";\ntry {\n  const inlined = await inlineLocalScript(scriptPath);\n} catch (e) {\n  if (e instanceof UnsupportedLocalPathScriptPreviewError && /codebase assets/.test(e.message)) {\n    console.error(`${scriptPath} needs codebase assets; deploy with 'wmill sync push' and reference it by path in the flow`);\n  } else throw e;\n}","preventionTips":["Before flow dev/preview, scan each referenced script's codebase for a non-empty assets array and switch those steps to deployed scripts","Keep asset-backed scripts out of local inline flow steps entirely","If an asset is small, embed its content in the script source instead of declaring it as an asset","Document the preview limitation for the team so new assets added to shared codebases don't silently break flow dev"],"tags":["esbuild","bundling","cli","unsupported-feature","assets"],"backgroundTag":"codebase-assets-unsupported-in-preview","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"}