{"record":{"id":"70b611cafeda1095","repo":"windmill-labs/windmill","slug":"workspace-name-is-not-defined-in-wmill-yaml","errorCode":null,"errorMessage":"Workspace '${name}' is not defined in wmill.yaml 'workspaces'. Add it there (its keys must match protection-rules.yaml).","messagePattern":"Workspace '(.+?)' is not defined in wmill\\.yaml 'workspaces'\\. Add it there \\(its keys must match protection-rules\\.yaml\\)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/protection-rules/file.ts","lineNumber":76,"sourceCode":"      string,\n      WorkspaceEntryConfig\n    >;\n    return new WorkspaceResolver(ws);\n  }\n\n  /** Workspace keys declared in wmill.yaml (excludes reserved keys). */\n  knownNames(): string[] {\n    return getWorkspaceNames(this.workspaces as any);\n  }\n\n  has(name: string): boolean {\n    return this.knownNames().includes(name);\n  }\n\n  /** Backend workspace id (path param) for a key, or throw if unknown. */\n  backendId(name: string): string {\n    if (!this.has(name)) {\n      throw new Error(\n        `Workspace '${name}' is not defined in wmill.yaml 'workspaces'. ` +\n          `Add it there (its keys must match protection-rules.yaml).`,\n      );\n    }\n    return getEffectiveWorkspaceId(name, this.workspaces[name]);\n  }\n}\n\n// Point the API client at the backend for a single wmill.yaml workspace key,\n// then return the backend workspace id to use as the path param. The backend\n// id always comes from the wmill.yaml mapping (the feature's invariant);\n// credentials are resolved with the same precedence as every other command:\n//\n//   1. explicit --base-url + --token  -> used as-is (stateless CI; no profile\n//      or wmill.yaml baseUrl required)\n//   2. otherwise, the stored profile matching wmill.yaml workspaces.<ws>\n//      (its baseUrl + token), with an explicit --token overriding the\n//      stored token","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/protection-rules/file.ts#L58-L94","documentation":"Lookup guard in the protection-rules WorkspaceResolver: a workspace key referenced by protection-rules.yaml (or passed via --workspace) is not declared under wmill.yaml's 'workspaces' mapping. The CLI maps logical workspace names to backend ids through wmill.yaml; the input at fault is the workspace name that exists in protection-rules.yaml (or the CLI arg) but has no wmill.yaml entry.","triggerScenarios":"Thrown at cli/src/commands/protection-rules/file.ts:76 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add the workspace to wmill.yaml under 'workspaces' with its baseUrl and any defaults","Fix the name in protection-rules.yaml so its keys match wmill.yaml exactly (reserved keys excluded)","Remove the stale workspace key from protection-rules.yaml if it's no longer managed"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}