{"record":{"id":"2fa76aa573554cf2","repo":"windmill-labs/windmill","slug":"no-output-files-found-for-filepath","errorCode":null,"errorMessage":"No output files found for ${filePath}","messagePattern":"No output files found for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/utils/local_path_scripts.ts","lineNumber":67,"sourceCode":"    entryPoints: [filePath],\n    // Inline rawscripts are executed through the standard module wrapper,\n    // so the bundle must expose `main` as an ESM export.\n    format: \"esm\",\n    bundle: true,\n    write: false,\n    external: codebase.external,\n    inject: codebase.inject,\n    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\";","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/utils/local_path_scripts.ts#L49-L85","documentation":"bundleSingleFileCodebaseScript in cli/src/utils/local_path_scripts.ts bundles a local codebase-backed PathScript with esbuild (write:false) for inlining into flow preview/dev. If esbuild's build result contains zero output files, which should not happen for a valid entry point, this generic Error is thrown with the script file path. It indicates the bundler produced nothing for the entry, usually because the build silently failed or the entry was empty.","triggerScenarios":"Calling the preview local-script reader (createPreviewLocalScriptReader → content → bundleSingleFileCodebaseScript) where esbuild.build({entryPoints:[filePath], write:false,...}) resolves with out.outputFiles.length === 0 — e.g. an empty/degenerate entry file or an esbuild configuration that emits no output for the entry.","commonSituations":"Pointing a script path at an empty or whitespace-only source file; a codebase config (loader/external/inject) so restrictive esbuild emits nothing; an esbuild version/config mismatch via the dynamic esbuild loader; a path resolving to a file that yields no module graph.","solutions":["Check the entry file at filePath is non-empty, valid TypeScript/JavaScript and resolves through the codebase config","Simplify the esbuild-relevant codebase settings (external/inject/loader/define) and retry to isolate which option suppresses output","Run the same build manually with esbuild CLI (write:false semantics aside) to see warnings/errors the CLI swallowed","Update or pin the esbuild version resolved by getEsbuild() to a known-good release","If it persists, report with the filePath and codebase config — this branch is a defensive invariant"],"exampleFix":"// before: empty entry produces zero outputs\n// scripts/foo.ts is 0 bytes\nwmill flow preview flow.yaml // Error: No output files found for scripts/foo.ts\n\n// after: ensure the entry exports main\n// scripts/foo.ts\nexport async function main() { return 42; }","handlingStrategy":"validation","validationCode":"const stat = await Deno.stat(filePath);\nif (!stat.isFile || stat.size === 0) {\n  throw new Error(`Refusing to inline ${filePath}: entry file is missing or empty`);\n}\nconst src = await Deno.readTextFile(filePath);\nif (!src.trim()) throw new Error(`${filePath} has no code; esbuild would emit no output`);","typeGuard":"function canBundle(outputFiles: readonly unknown[] | undefined): outputFiles is [unknown, ...unknown[]] {\n  return Array.isArray(outputFiles) && outputFiles.length > 0;\n}","tryCatchPattern":"try {\n  const bundled = await bundleScript(filePath);\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith(\"No output files found for\")) {\n    console.error(`esbuild emitted nothing for ${e.message.split(\"for \")[1]} — check the entry file is non-empty and the codebase config is valid`);\n  } else throw e;\n}","preventionTips":["Keep codebase entry scripts non-empty with an exported main()","Validate the codebase's esbuild options (external/inject/loader/define) after each change with a standalone esbuild run","Pin esbuild to a known-good version in the environment providing the dynamic import","Lint that every script path referenced by a flow resolves to an existing, non-empty file"],"tags":["esbuild","bundling","cli","local-scripts"],"backgroundTag":"empty-bundle-output","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"}