windmill-labs/windmill · error · Error
Refusing to rename your current branch \`${currentBranch}\`
Error message
Refusing to rename your current branch \`${currentBranch}\` — it looks like a base branch (mapped to a workspace in wmill.yaml, or main/master). Check out the disposable working branch you want to convert first. What it means
With `--from-branch`, the CLI renames the current branch into the fork branch (git branch -m). Renaming a 'base branch' — one mapped to a workspace in wmill.yaml or the conventional main/master — would rebind the workspace-to-branch mapping and break the git sync workflow. The guard `isBaseBranch(currentBranch)` throws before any rename happens.
Source
Thrown at cli/src/commands/workspace/fork.ts:70
branch === "master" ||
findWorkspaceByGitBranch(config.workspaces, branch) !== undefined;
// Decide the base branch the fork links to, and whether to rename the
// current working branch onto the fork branch. Auto-detected from where you
// are; `--from-branch` is the explicit/non-interactive override.
let clonedBranchName: string;
let renameCurrent: boolean;
if (opts.fromBranch) {
// Explicit override: base on <fromBranch>, rename the current branch.
if (opts.fromBranch === currentBranch) {
throw new Error(
`--from-branch is for converting a *different* working branch into the fork branch, but you are already on \`${currentBranch}\`. ` +
`Omit --from-branch to create a fresh fork branch with \`git checkout -b\`.`,
);
}
if (isBaseBranch(currentBranch)) {
throw new Error(
`Refusing to rename your current branch \`${currentBranch}\` — it looks like a base branch (mapped to a workspace in wmill.yaml, or main/master). ` +
`Check out the disposable working branch you want to convert first.`,
);
}
if (getOriginalBranchForWorkspaceForks(currentBranch)) {
// Current branch is itself a fork branch (wm-fork/<base>/<old-id>).
// Renaming it onto the new fork branch would detach the existing fork.
throw new Error(
`Refusing to rename your current branch \`${currentBranch}\` — it is already a fork branch. ` +
`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.`,
);
}
if (!findWorkspaceByGitBranch(config.workspaces, opts.fromBranch)) {
throw new Error(
`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).`,
);
}View on GitHub (pinned to e474e8803c)
Solutions
- Check out the disposable working branch you want to convert first: `git switch <working-branch>`, then run the fork command with --from-branch
- If you want a fresh fork branch instead, omit --from-branch (allowed from a base branch) and the CLI will `git checkout -b` a new fork branch
- Rename or unmap the branch in wmill.yaml only if you truly intend to rebind the base workspace
Example fix
// before git switch main wmill workspace fork --from-branch develop # refusal // after git switch my-experimental-branch wmill workspace fork --from-branch develop
Defensive patterns
Strategy: validation
Validate before calling
const current = execSync('git branch --show-current', { encoding: 'utf8' }).trim();
const isBase = current === 'main' || current === 'master' || config.workspaces.some(w => w.gitBranch === current);
if (opts.fromBranch && isBase) {
throw new Error(`Check out a disposable working branch before using --from-branch (on ${current}).`);
}
await createWorkspaceFork(opts, name); Type guard
function isBaseBranch(branch: string, workspaces: { gitBranch?: string }[]): boolean {
return branch === 'main' || branch === 'master' || workspaces.some(w => w.gitBranch === branch);
} Try / catch
try {
await createWorkspaceFork(opts, name);
} catch (e) {
if ((e as Error).message.includes('looks like a base branch')) {
console.error('git switch to your working branch first, then retry with --from-branch.');
} else throw e;
} Prevention
- Never sit on main/master when converting a branch with --from-branch
- Keep wmill.yaml branch mappings in mind before renaming branches
- From a base branch, omit --from-branch to get a fresh fork branch via checkout -b
When it happens
Trigger: Running `wmill workspace fork --from-branch <other>` while the current branch is `main`, `master`, or a branch mapped to a workspace in wmill.yaml's workspaces section.
Common situations: Trying to fork while still sitting on main instead of a feature branch; wmill.yaml maps several branches to workspaces and the user forgot which one they are on; habit of running fork from the default checkout branch.
Related errors
- You can only create forks within a git repo. Forks are track
- Could not get git branch name
- --from-branch is for converting a *different* working branch
- Refusing to rename your current branch \`${currentBranch}\`
- Could not find a workspace mapped to branch \`${opts.fromBra
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/f258bee0c6860f8e.
Report an issue: GitHub.