windmill-labs/windmill · error

Cannot derive a Windmill path from '${arg}'${remotePath ? `

Error message

Cannot derive a Windmill path from '${arg}'${remotePath ? ` (it maps to '${remotePath}')` : ''}: a preview runs under the path of the file it previews, which must sit inside the wmill.yaml root and be of the form <u|g|f>/<username|group|folder>/<name>.

What it means

assertRemotePath guards the path a preview run is pushed under: preview jobs have no runnable of their own, so the path must be a valid Windmill workspace path (u|g|f/<folder>/<name>) inside the wmill.yaml root; the given argument does not match that shape, so the job would have no usable identity.

Source

Thrown at cli/src/core/context.ts:827

 */
function realpathOfNamed(p: string): string {
  return existsSync(p)
    ? realpathSync(p)
    : join(realpathSync(dirname(p)), basename(p));
}

/** Windmill workspace path: `u|f|g` followed by at least a folder and a name. */
const REMOTE_PATH_RE = /^[ufg](\/[^/]+){2,}$/;

/**
 * Guard the Windmill path a preview run is pushed under. A preview job carries
 * no runnable of its own, so this path is the only identity it has: it is what
 * `WM_JOB_PATH` reports, what the runs page links to, and what relative imports
 * inside the previewed code resolve against.
 */
export function assertRemotePath(remotePath: string, arg: string): void {
  if (REMOTE_PATH_RE.test(remotePath)) return;
  throw new Error(
    `Cannot derive a Windmill path from '${arg}'` +
      (remotePath ? ` (it maps to '${remotePath}')` : "") +
      `: a preview runs under the path of the file it previews, which must sit inside the ` +
      `wmill.yaml root and be of the form <u|g|f>/<username|group|folder>/<name>.`
  );
}

export function validatePath(path: string): boolean {
  if (!(path.startsWith("g") || path.startsWith("u") || path.startsWith("f"))) {
    log.infoStderr(
      colors.red(
        "Given remote path looks invalid. Remote paths are typically of the form <u|g|f>/<username|group|folder>/..."
      )
    );
    return false;
  }

  return true;

View on GitHub (pinned to e474e8803c)

Solutions

  1. Preview a file that sits inside the wmill.yaml root directory.
  2. Ensure the target maps to a path of the form u/<user>/<name>, g/<group>/<name>, or f/<folder>/<name>.
  3. Check the mapped remote path reported in the message for missing folder segments.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cli/src/core/context.ts:827 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/5b351ceff233e008. Report an issue: GitHub.