windmill-labs/windmill · error · UnsupportedLocalPathScriptPreviewError
Local PathScript ${filePath} requires codebase assets, which
Error message
Local PathScript ${filePath} requires codebase assets, which flow preview/dev cannot inline yet What it means
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.
Source
Thrown at cli/src/utils/local_path_scripts.ts:75
define: codebase.define,
loader: codebase.loader ?? { ".node": "file" },
outdir: "/",
platform: "node",
packages: "bundle",
target: "esnext",
banner: codebase.banner,
});
if (out.outputFiles.length === 0) {
throw new Error(`No output files found for ${filePath}`);
}
if (out.outputFiles.length > 1) {
throw new UnsupportedLocalPathScriptPreviewError(
`Local PathScript ${filePath} requires a multi-file bundle, which flow preview/dev cannot inline yet`
);
}
if (Array.isArray(codebase.assets) && codebase.assets.length > 0) {
throw new UnsupportedLocalPathScriptPreviewError(
`Local PathScript ${filePath} requires codebase assets, which flow preview/dev cannot inline yet`
);
}
return out.outputFiles[0].text;
}
export function createPreviewLocalScriptReader(opts: {
exts: string[];
defaultTs?: "bun" | "deno";
codebases: SyncCodebase[];
}): (scriptPath: string) => Promise<LocalScriptInfo | undefined> {
return async (scriptPath) => {
const localScript = await resolvePreviewLocalScriptState(scriptPath, opts);
if (!localScript) {
return undefined;
}
View on GitHub (pinned to e474e8803c)
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
Example fix
// before: flow dev on a step whose codebase declares assets
codebase: { assets: ["data.csv"] }
wmill flow dev flow.yaml // UnsupportedLocalPathScriptPreviewError
// after: deploy the codebase script and reference it in the flow instead of inlining
wmill sync push // script with assets deployed
// flow step: path: f/scripts/asset_script instead of a local inline file Defensive patterns
Strategy: validation
Validate before calling
if (Array.isArray(codebase.assets) && codebase.assets.length > 0 && isFlowPreviewPath(scriptPath)) {
throw new Error(`${scriptPath}'s codebase declares ${codebase.assets.length} asset(s); flow preview/dev cannot inline them — deploy via 'wmill sync push'`);
} Type guard
function isUnsupportedPreviewError(err: unknown): err is import("./local_path_scripts.ts").UnsupportedLocalPathScriptPreviewError {
return err instanceof Error && err.name === "UnsupportedLocalPathScriptPreviewError";
} Try / catch
import { UnsupportedLocalPathScriptPreviewError } from "./utils/local_path_scripts.ts";
try {
const inlined = await inlineLocalScript(scriptPath);
} catch (e) {
if (e instanceof UnsupportedLocalPathScriptPreviewError && /codebase assets/.test(e.message)) {
console.error(`${scriptPath} needs codebase assets; deploy with 'wmill sync push' and reference it by path in the flow`);
} else throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Local PathScript ${filePath} requires a multi-file bundle, w
- No output files found for ${filePath}
- native esbuild is not usable; falling back to esbuild-wasm (
- result.substring(__ERR_PREFIX.length)
- App ${appPath} not found
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/28333181dbaa79d7.
Report an issue: GitHub.