windmill-labs/windmill · warning

⚠️ Workspace '${wsNameForConfig}' is not defined in the 'wo

Error message

⚠️  Workspace '${wsNameForConfig}' is not defined in the 'workspaces' section of wmill.yaml.
   No workspace-specific overrides will be applied. Available workspaces: ${wsNames.join(", ")}

What it means

A warning from warnWorkspaceOverride in the Windmill CLI sync tool. When running `wmill sync pull/push` with workspace-specific overrides, the workspace name resolved from the flags is not a key in the 'workspaces' section of wmill.yaml, so no per-workspace overrides (specificItems, etc.) can be applied. The sync proceeds with only the common configuration.

Source

Thrown at cli/src/commands/sync/sync.ts:478

  return undefined;
}

// Warn if --workspace overrides auto-detected branch or if workspace not in config.
function warnWorkspaceOverride(
  opts: SyncOptions,
  wsNameForConfig: string | undefined,
): void {
  if (!wsNameForConfig || !opts.workspaces) return;

  // Check if workspace exists in config
  const wsEntry = (opts.workspaces as any)?.[wsNameForConfig] as
    WorkspaceEntryConfig | undefined;
  if (!wsEntry) {
    const wsNames = Object.keys(opts.workspaces).filter(
      (k) => k !== "commonSpecificItems",
    );
    if (wsNames.length > 0) {
      log.warn(
        `⚠️  Workspace '${wsNameForConfig}' is not defined in the 'workspaces' section of wmill.yaml.\n` +
          `   No workspace-specific overrides will be applied. Available workspaces: ${wsNames.join(", ")}`,
      );
    }
    return;
  }

  // Check if current git branch maps to a different workspace
  if (isGitRepository()) {
    const currentBranch = getCurrentGitBranch();
    if (currentBranch) {
      const autoMatch = findWorkspaceByGitBranch(
        opts.workspaces,
        currentBranch,
      );
      if (autoMatch && autoMatch[0] !== wsNameForConfig) {
        log.info(
          `Current git branch '${currentBranch}' maps to workspace '${autoMatch[0]}', ` +

View on GitHub (pinned to e474e8803c)

Solutions

  1. Add the workspace name as a key under the `workspaces:` section of wmill.yaml (copy an existing entry as a template).
  2. Re-run with a --workspace value that matches an existing key; run `wmill workspace list` to confirm the exact name.
  3. Check for typos/case differences between the flag value and the YAML key.
  4. If per-workspace overrides are genuinely not needed, ignore the warning — sync still works with common settings.

Example fix

// before (wmill.yaml)
workspaces:
  prod:
    specificItems: [...]
// after
workspaces:
  prod:
    specificItems: [...]
  staging:          # added so `--workspace staging` stops warning
    specificItems: [...]
Defensive patterns

Strategy: validation

Validate before calling

import { readConfig } from "windmill-cli";
const cfg = await readConfig("wmill.yaml");
const wsNames = Object.keys(cfg.workspaces ?? {}).filter(k => k !== "commonSpecificItems");
if (process.argv.includes("--workspace") && !wsNames.includes(myWorkspace)) {
  throw new Error(`--workspace '${myWorkspace}' not in wmill.yaml workspaces: ${wsNames.join(", ")}`);
}

Type guard

function isDefinedWorkspace(name: string, cfg: { workspaces?: Record<string, unknown> }): boolean {
  return !!cfg.workspaces && Object.hasOwn(cfg.workspaces, name);
}

Try / catch

// warning is not thrown; capture via log listener if you must fail on it
const origWarn = log.warn;
log.warn = (msg: string) => { if (msg.includes("is not defined in the 'workspaces' section")) throw new Error(msg); origWarn(msg); };

Prevention

When it happens

Trigger: Running `wmill sync pull` or `wmill sync push` with --workspace (or a profile/branch that resolves a name) that does not match any key under `workspaces:` in wmill.yaml, while a `workspaces` section exists in the file. Only fires when at least one workspace IS defined (wsNames.length > 0).

Common situations: Typo in the --workspace flag value; renaming a workspace key in wmill.yaml without updating CI scripts; using a workspace that exists on the server but was never added to the YAML config; running from a repo whose wmill.yaml defines different workspaces than the one the developer's CLI is logged into.

Related errors


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