{"record":{"id":"47bbb9209e546b06","repo":"windmill-labs/windmill","slug":"could-not-find-a-workspace-mapped-to-branch-op","errorCode":null,"errorMessage":"Could not find a workspace mapped to branch \\`${opts.fromBranch}\\` in wmill.yaml's workspaces section. Pass the base branch your fork should be based on (e.g. the branch bound to the parent workspace).","messagePattern":"Could not find a workspace mapped to branch \\\\`(.+?)\\\\` in wmill\\.yaml's workspaces section\\. Pass the base branch your fork should be based on \\(e\\.g\\. the branch bound to the parent workspace\\)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/workspace/fork.ts","lineNumber":84,"sourceCode":"        `Omit --from-branch to create a fresh fork branch with \\`git checkout -b\\`.`,\n      );\n    }\n    if (isBaseBranch(currentBranch)) {\n      throw new Error(\n        `Refusing to rename your current branch \\`${currentBranch}\\` — it looks like a base branch (mapped to a workspace in wmill.yaml, or main/master). ` +\n        `Check out the disposable working branch you want to convert first.`,\n      );\n    }\n    if (getOriginalBranchForWorkspaceForks(currentBranch)) {\n      // Current branch is itself a fork branch (wm-fork/<base>/<old-id>).\n      // Renaming it onto the new fork branch would detach the existing fork.\n      throw new Error(\n        `Refusing to rename your current branch \\`${currentBranch}\\` — it is already a fork branch. ` +\n        `To fork a fork, omit --from-branch: \\`wmill workspace fork\\` bases the new fork on this fork's original branch and creates a fresh fork branch without renaming.`,\n      );\n    }\n    if (!findWorkspaceByGitBranch(config.workspaces, opts.fromBranch)) {\n      throw new Error(\n        `Could not find a workspace mapped to branch \\`${opts.fromBranch}\\` in wmill.yaml's workspaces section. ` +\n        `Pass the base branch your fork should be based on (e.g. the branch bound to the parent workspace).`,\n      );\n    }\n    clonedBranchName = opts.fromBranch;\n    renameCurrent = true;\n  } else if (originalBranchIfForked) {\n    // Fork of a fork: link to the original branch; user checks out a new branch.\n    log.info(`You are creating a fork of a fork. The branch will be linked to the original branch this was forked from, i.e. \\`${originalBranchIfForked}\\`, for all settings and overrides.`);\n    clonedBranchName = originalBranchIfForked;\n    renameCurrent = false;\n  } else if (isBaseBranch(currentBranch)) {\n    // On a base branch: base the fork on it; user checks out a fresh fork branch.\n    clonedBranchName = currentBranch;\n    renameCurrent = false;\n  } else {\n    // On a non-base working branch: offer to base the fork on it and rename it.\n    clonedBranchName = await resolveWorkingBranchBase(config, opts, currentBranch);","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/workspace/fork.ts#L66-L102","documentation":"When `--from-branch <B>` is given, B must be a base branch — i.e. a branch explicitly mapped to a workspace in wmill.yaml's workspaces section — because the fork clones that workspace. If no workspace in the config maps to B, the CLI cannot know which workspace to fork and throws.","triggerScenarios":"Running `wmill workspace fork --from-branch <B>` where B is a real git branch but has no corresponding entry under workspaces in wmill.yaml (typo in branch name, branch mapping deleted, or pointing at a non-base feature branch).","commonSituations":"Typos in the branch name; teammate deleted the wmill.yaml mapping; pointing --from-branch at a local-only branch never bound to a workspace; stale local wmill.yaml after pulling config changes.","solutions":["Check `wmill.yaml` workspaces section and pass a branch that is actually mapped to the parent workspace","Fix the branch name typo (compare with `git branch -a` and the wmill.yaml entries)","Add/reinstate the workspace-to-branch mapping in wmill.yaml for the intended base branch"],"exampleFix":"// before\nwmill workspace fork --from-branch develop  # no mapping in wmill.yaml\n// after\nwmill workspace fork --from-branch main  # main is mapped to the prod workspace in wmill.yaml","handlingStrategy":"validation","validationCode":"const mapped = config.workspaces?.find(w => w.gitBranch === opts.fromBranch);\nif (opts.fromBranch && !mapped) {\n  throw new Error(`Branch '${opts.fromBranch}' is not mapped to a workspace in wmill.yaml.`);\n}\nawait createWorkspaceFork(opts, name);","typeGuard":"function branchIsMapped(branch: string, workspaces: { gitBranch?: string }[] | undefined): boolean {\n  return !!workspaces?.some(w => w.gitBranch === branch);\n}","tryCatchPattern":"try {\n  await createWorkspaceFork(opts, name);\n} catch (e) {\n if ((e as Error).message.includes(\"mapped to branch\") && e.message.includes('workspaces section')) {\n    console.error('Pass a base branch listed under workspaces in wmill.yaml.');\n  } else throw e;\n}","preventionTips":["Keep wmill.yaml workspaces section in sync across the team (commit it)","Tab-complete branch names from wmill.yaml, not from `git branch`","Only pass base branches (workspace-bound) to --from-branch"],"tags":["git","config","wmill-yaml","cli"],"backgroundTag":"missing-branch-workspace-mapping","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"}