windmill-labs/windmill · error · Error

file path must refer to a file.

Error message

file path must refer to a file.

What it means

Fired by `wmill variable push` after stat-ing the local path: the path exists but is not a regular file (typically a directory). Generic validation guard; the faulting input is the filePath CLI argument. Throwing aborts the variable push before parsing the variable file.

Source

Thrown at cli/src/commands/variable/variable.ts:214

    });
  }
}

async function push(
  opts: GlobalOptions & { plainSecrets: boolean },
  filePath: string,
  remotePath: string
) {
  const workspace = await resolveWorkspace(opts);
  await requireLogin(opts);

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

  const fstat = await stat(filePath);
  if (!fstat.isFile()) {
    throw new Error("file path must refer to a file.");
  }

  log.info(colors.bold.yellow("Pushing variable..."));

  const local = parseFromFile(filePath) as VariableFile;

  // A secret value in a single-file push is authored by the user and is
  // therefore plaintext that must be encrypted server-side — unless it has the
  // shape of workspace ciphertext (a value round-tripped from `sync pull`).
  // Pushing plaintext as already-encrypted would brick the variable. An explicit
  // --plain-secrets always forces the plaintext (encrypt) path.
  let plainSecrets = opts.plainSecrets ?? false;
  if (opts.plainSecrets === undefined && local.is_secret) {
    if (!looksLikeWorkspaceCiphertext(local.value)) {
      log.info(
        colors.yellow(
          "Secret value is not in encrypted form; pushing as plaintext to be encrypted server-side (pass --plain-secrets to silence)."
        )

View on GitHub (pinned to e474e8803c)

Solutions

  1. Pass the .variable.yaml file path, not a directory.
  2. Use `wmill sync push` to push a whole folder of variables.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cli/src/commands/variable/variable.ts:214 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/1e9a7475f1a3cb06. Report an issue: GitHub.