windmill-labs/windmill · error

file path must refer to a file.

Error message

file path must refer to a file.

What it means

Fired by `wmill script push` when the local path given for the script does not pass validatePath's check that the path refers to an existing regular file. This is a generic validation guard: the faulting input is the CLI filePath argument, which typically points to a directory, a glob, or a nonexistent location instead of the script's YAML/TS file. The command exits early (returns, not throws) after printing the validation message.

Source

Thrown at cli/src/commands/script/script.ts:186

async function push(opts: PushOptions, filePath: string) {
  opts = await mergeConfigWithConfigFile(opts);
  const workspace = await resolveWorkspace(opts);

  if (!validatePath(filePath)) {
    return;
  }

  // A dbt project's descriptor is optional, so the one content path a
  // descriptor-less project has is deliberately not on disk. The project beside
  // it is what says the script is real.
  const absentDescriptor = await stat(filePath).then(
    () => false,
    (e) => isMissingDbtDescriptor(filePath, e)
  );
  if (!absentDescriptor) {
    const fstat = await stat(filePath);
    if (!fstat.isFile()) {
      throw new Error("file path must refer to a file.");
    }
  }

  if (filePath.endsWith(".script.json") || filePath.endsWith(".script.yaml")) {
    throw Error(
      "Cannot push a script metadata file, point to the script content file instead (.py, .ts, .go|.sh)"
    );
  }

  if (isFileResource(filePath) || isFilesetResource(filePath)) {
    throw Error(
      "Cannot push a file/fileset resource content file as a script, push its .resource.yaml with 'wmill resource push' instead"
    );
  }

  await requireLogin(opts);

  // Warn about metadata state before pushing

View on GitHub (pinned to e474e8803c)

Solutions

  1. Pass the script file (e.g. script.ts or script.yaml), not a directory.
  2. For folder pushes use `wmill sync push` / `wmill script push --all` instead of pointing at the folder.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cli/src/commands/script/script.ts:186 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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