{"record":{"id":"f33c9607fbc7cc13","repo":"windmill-labs/windmill","slug":"workspace-wsnameforconfig-is-not-defined","errorCode":null,"errorMessage":"⚠️  Workspace '${wsNameForConfig}' is not defined in the 'workspaces' section of wmill.yaml.\n   No workspace-specific overrides will be applied. Available workspaces: ${wsNames.join(\", \")}","messagePattern":"⚠️  Workspace '(.+?)' is not defined in the 'workspaces' section of wmill\\.yaml\\.\n   No workspace-specific overrides will be applied\\. Available workspaces: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cli/src/commands/sync/sync.ts","lineNumber":478,"sourceCode":"  return undefined;\n}\n\n// Warn if --workspace overrides auto-detected branch or if workspace not in config.\nfunction warnWorkspaceOverride(\n  opts: SyncOptions,\n  wsNameForConfig: string | undefined,\n): void {\n  if (!wsNameForConfig || !opts.workspaces) return;\n\n  // Check if workspace exists in config\n  const wsEntry = (opts.workspaces as any)?.[wsNameForConfig] as\n    WorkspaceEntryConfig | undefined;\n  if (!wsEntry) {\n    const wsNames = Object.keys(opts.workspaces).filter(\n      (k) => k !== \"commonSpecificItems\",\n    );\n    if (wsNames.length > 0) {\n      log.warn(\n        `⚠️  Workspace '${wsNameForConfig}' is not defined in the 'workspaces' section of wmill.yaml.\\n` +\n          `   No workspace-specific overrides will be applied. Available workspaces: ${wsNames.join(\", \")}`,\n      );\n    }\n    return;\n  }\n\n  // Check if current git branch maps to a different workspace\n  if (isGitRepository()) {\n    const currentBranch = getCurrentGitBranch();\n    if (currentBranch) {\n      const autoMatch = findWorkspaceByGitBranch(\n        opts.workspaces,\n        currentBranch,\n      );\n      if (autoMatch && autoMatch[0] !== wsNameForConfig) {\n        log.info(\n          `Current git branch '${currentBranch}' maps to workspace '${autoMatch[0]}', ` +","sourceCodeStart":460,"sourceCodeEnd":496,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/sync/sync.ts#L460-L496","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Add the workspace name as a key under the `workspaces:` section of wmill.yaml (copy an existing entry as a template).","Re-run with a --workspace value that matches an existing key; run `wmill workspace list` to confirm the exact name.","Check for typos/case differences between the flag value and the YAML key.","If per-workspace overrides are genuinely not needed, ignore the warning — sync still works with common settings."],"exampleFix":"// before (wmill.yaml)\nworkspaces:\n  prod:\n    specificItems: [...]\n// after\nworkspaces:\n  prod:\n    specificItems: [...]\n  staging:          # added so `--workspace staging` stops warning\n    specificItems: [...]","handlingStrategy":"validation","validationCode":"import { readConfig } from \"windmill-cli\";\nconst cfg = await readConfig(\"wmill.yaml\");\nconst wsNames = Object.keys(cfg.workspaces ?? {}).filter(k => k !== \"commonSpecificItems\");\nif (process.argv.includes(\"--workspace\") && !wsNames.includes(myWorkspace)) {\n  throw new Error(`--workspace '${myWorkspace}' not in wmill.yaml workspaces: ${wsNames.join(\", \")}`);\n}","typeGuard":"function isDefinedWorkspace(name: string, cfg: { workspaces?: Record<string, unknown> }): boolean {\n  return !!cfg.workspaces && Object.hasOwn(cfg.workspaces, name);\n}","tryCatchPattern":"// warning is not thrown; capture via log listener if you must fail on it\nconst origWarn = log.warn;\nlog.warn = (msg: string) => { if (msg.includes(\"is not defined in the 'workspaces' section\")) throw new Error(msg); origWarn(msg); };","preventionTips":["Keep workspace names in wmill.yaml as the single source; derive CI --workspace values from it, not vice versa.","Add a CI lint step that validates every --workspace used in scripts exists in wmill.yaml.","After renaming a workspace key, grep all pipelines for the old name.","Use `wmill workspace list` to confirm exact names before scripting against them."],"tags":["cli","config","windmill","wmill-yaml"],"backgroundTag":"workspace-not-in-config","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}