windmill-labs/windmill · error · Error
Refusing to rename your current branch \`${currentBranch}\`
Error message
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. What it means
The current branch is itself a fork branch (wm-fork/<base>/<old-id>). Renaming it onto a new fork branch would silently detach the existing fork from its branch mapping, losing the git sync linkage. The CLI blocks this and instead tells you how to fork a fork properly: omit --from-branch, which bases the new fork on the current fork's original branch and creates a fresh branch without renaming.
Source
Thrown at cli/src/commands/workspace/fork.ts:78
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).`,
);
}
clonedBranchName = opts.fromBranch;
renameCurrent = true;
} else if (originalBranchIfForked) {
// Fork of a fork: link to the original branch; user checks out a new branch.
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.`);
clonedBranchName = originalBranchIfForked;
renameCurrent = false;
} else if (isBaseBranch(currentBranch)) {View on GitHub (pinned to e474e8803c)
Solutions
- Omit --from-branch: run plain `wmill workspace fork` from the fork branch to create a fork-of-fork linked to the original base branch
- If you meant to fork a different branch, first switch to a non-fork working branch: `git switch <base-or-working-branch>`
Example fix
// before git switch wm-fork/main/my-feature wmill workspace fork --from-branch main # refusal // after wmill workspace fork # fork of a fork, based on original branch 'main'
Defensive patterns
Strategy: validation
Validate before calling
const WM_FORK_PREFIX = 'wm-fork';
const current = execSync('git branch --show-current', { encoding: 'utf8' }).trim();
if (opts.fromBranch && current.startsWith(`${WM_FORK_PREFIX}/`)) {
throw new Error('Already on a fork branch: omit --from-branch to fork the fork.');
}
await createWorkspaceFork(opts, name); Type guard
function isForkBranch(branch: string, prefix = 'wm-fork'): boolean {
return branch.startsWith(`${prefix}/`);
} Try / catch
try {
await createWorkspaceFork(opts, name);
} catch (e) {
if ((e as Error).message.includes('already a fork branch')) {
console.error('Run `wmill workspace fork` without --from-branch to create a fork of the fork.');
} else throw e;
} Prevention
- Recognize wm-fork/<base>/<id> branch names before applying git branch -m
- To fork a fork, run the command with no --from-branch while on the fork branch
- Never rename fork branches manually with git branch -m
When it happens
Trigger: Running `wmill workspace fork --from-branch <X>` while HEAD is on a branch whose name matches wm-fork/<base>/<id> (i.e. getOriginalBranchForWorkspaceForks returns a value).
Common situations: Chaining forks: user already created one fork and now tries to fork it again while still on the fork branch with --from-branch still in the command line from the previous invocation.
Related errors
- You can only create forks within a git repo. Forks are track
- Could not resolve parent workspace. Make sure you are in a g
- Could not get git branch name
- --from-branch is for converting a *different* working branch
- Refusing to rename your current branch \`${currentBranch}\`
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/8e7187e8a3a893f1.
Report an issue: GitHub.