windmill-labs/windmill · error

No output files found for ${filePath}

Error message

No output files found for ${filePath}

What it means

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.

Source

Thrown at cli/src/utils/local_path_scripts.ts:67

    entryPoints: [filePath],
    // Inline rawscripts are executed through the standard module wrapper,
    // so the bundle must expose `main` as an ESM export.
    format: "esm",
    bundle: true,
    write: false,
    external: codebase.external,
    inject: codebase.inject,
    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";

View on GitHub (pinned to e474e8803c)

Solutions

  1. Check the entry file at filePath is non-empty, valid TypeScript/JavaScript and resolves through the codebase config
  2. Simplify the esbuild-relevant codebase settings (external/inject/loader/define) and retry to isolate which option suppresses output
  3. Run the same build manually with esbuild CLI (write:false semantics aside) to see warnings/errors the CLI swallowed
  4. Update or pin the esbuild version resolved by getEsbuild() to a known-good release
  5. If it persists, report with the filePath and codebase config — this branch is a defensive invariant

Example fix

// before: empty entry produces zero outputs
// scripts/foo.ts is 0 bytes
wmill flow preview flow.yaml // Error: No output files found for scripts/foo.ts

// after: ensure the entry exports main
// scripts/foo.ts
export async function main() { return 42; }
Defensive patterns

Strategy: validation

Validate before calling

const stat = await Deno.stat(filePath);
if (!stat.isFile || stat.size === 0) {
  throw new Error(`Refusing to inline ${filePath}: entry file is missing or empty`);
}
const src = await Deno.readTextFile(filePath);
if (!src.trim()) throw new Error(`${filePath} has no code; esbuild would emit no output`);

Type guard

function canBundle(outputFiles: readonly unknown[] | undefined): outputFiles is [unknown, ...unknown[]] {
  return Array.isArray(outputFiles) && outputFiles.length > 0;
}

Try / catch

try {
  const bundled = await bundleScript(filePath);
} catch (e) {
  if (e instanceof Error && e.message.startsWith("No output files found for")) {
    console.error(`esbuild emitted nothing for ${e.message.split("for ")[1]} — check the entry file is non-empty and the codebase config is valid`);
  } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/2fa76aa573554cf2. Report an issue: GitHub.