windmill-labs/windmill · error · Error

Workspace folder not found, are you in the right directory?

Error message

Workspace folder not found, are you in the right directory?

What it means

During 'wmill instance push', the CLI changes directory into each local workspace folder relative to the repo root before reading its settings. If the chdir fails — the folder recorded in wmill.yaml doesn't exist on disk — it throws this error asking whether you're in the right directory.

Source

Thrown at cli/src/commands/instance/instance.ts:522

    const previousActiveWorkspace = await getActiveWorkspace(undefined);

    const localWorkspaces = await getLocalWorkspaces(
      rootDir,
      localPrefix,
      opts.folderPerInstance,
    );

    log.info(
      `\nPushing all workspaces: ${
        localWorkspaces.map((x) => x.id).join(", ")
      }`,
    );
    for (const localWorkspace of localWorkspaces) {
      log.info("\nPushing workspace " + localWorkspace.id);
      try {
        process.chdir(path.join(rootDir, localWorkspace.dir));
      } catch (_) {
        throw new Error(
          "Workspace folder not found, are you in the right directory?",
        );
      }

      try {
        const workspaceSettings = (await yamlParseFile(
          path.join(process.cwd(), "settings.yaml"),
        )) as SimplifiedSettings;
        await workspaceSetup(
          {
            token: instance.token,
            workspace: undefined,
            baseUrl: undefined,
            configDir: undefined,
            create: true,
            createWorkspaceName: workspaceSettings.name,
            createUsername: undefined,
          },

View on GitHub (pinned to e474e8803c)

Solutions

  1. Run the command from the repository root (where wmill.yaml lives)
  2. Compare wmill.yaml workspace entries against actual folders on disk; fix or remove stale entries
  3. Restore or re-clone missing workspace folders
  4. Use targeted push (single workspace) to skip the broken folder, then repair wmill.yaml

Example fix

// before (from wrong dir)
cd myrepo/frontend && wmill instance push
// after
cd myrepo && wmill instance push  # root containing wmill.yaml and workspace folders
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync } from "node:fs";
import YAML from "yaml";
const cfg = YAML.parse(await Deno.readTextFile("wmill.yaml"));
for (const ws of cfg.workspaces ?? []) {
  if (!existsSync(ws.folder_path)) {
    throw new Error(`wmill.yaml references missing folder: ${ws.folder_path}`);
  }
}

Try / catch

try {
  await wmillInstancePush();
} catch (e) {
  if (String(e).includes("Workspace folder not found")) {
    console.error("Run from the repo root containing wmill.yaml and all workspace folders");
  }
}

Prevention

When it happens

Trigger: Running 'wmill instance push' from a directory other than the repo root when wmill.yaml lists workspace dirs, or after workspace folders were renamed/deleted/moved locally while wmill.yaml still references the old paths.

Common situations: Running the push from a subdirectory or a CI checkout that excludes some folders; branch where a workspace folder was removed but wmill.yaml wasn't updated; case-sensitivity mismatch on filesystems.

Related errors


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