windmill-labs/windmill · error · Error
--from-branch is for converting a *different* working branch
Error message
--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\`. What it means
`--from-branch` explicitly means 'rename my current disposable working branch onto the new fork branch, basing it on <from-branch>'. Passing the branch you are currently standing on as `--from-branch` is contradictory: there is nothing different to convert. The CLI detects `opts.fromBranch === currentBranch` and throws before touching anything.
Source
Thrown at cli/src/commands/workspace/fork.ts:64
const originalBranchIfForked = getOriginalBranchForWorkspaceForks(currentBranch);
// A "base branch" is one we must not rename onto a fork branch: mapped to a
// workspace in wmill.yaml, or a conventional default (main/master).
const isBaseBranch = (branch: string): boolean =>
branch === "main" ||
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.`,
);
}View on GitHub (pinned to e474e8803c)
Solutions
- Omit `--from-branch` if you want a fresh fork branch created via git checkout -b
- If you really want to convert the current branch, just run `wmill workspace fork` without the flag while on a non-base working branch
- Pass a different branch (the base branch mapped to the parent workspace) as --from-branch
Example fix
// before git switch feature-x wmill workspace fork --from-branch feature-x # error // after wmill workspace fork # omit --from-branch; converts feature-x into the fork branch
Defensive patterns
Strategy: validation
Validate before calling
const current = execSync('git branch --show-current', { encoding: 'utf8' }).trim();
if (opts.fromBranch && opts.fromBranch === current) {
throw new Error(`Omit --from-branch: you are already on ${current}.`);
}
await createWorkspaceFork(opts, name); Type guard
null
Try / catch
try {
await createWorkspaceFork(opts, name);
} catch (e) {
if ((e as Error).message.includes('is for converting a *different* working branch')) {
console.error('Drop --from-branch or check out a different branch first.');
} else throw e;
} Prevention
- Only pass --from-branch when the current branch differs from it
- Don't script `--from-branch $(git branch --show-current)`
- Remember --from-branch implies a rename of the current branch
When it happens
Trigger: Running `wmill workspace fork --from-branch <X>` while HEAD is already on branch X.
Common situations: Copy-pasting a command template that hardcodes the branch name; confusing --from-branch with the base branch you are already on; scripting the command with `$(git branch --show-current)` as the flag value.
Understand the failure class
Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.
Related errors
- file path must refer to a file.
- file path must refer to a file.
- You can only create forks within a git repo. Forks are track
- Could not get git branch name
- Refusing to rename your current branch \`${currentBranch}\`
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/ccb1334879150f1e.
Report an issue: GitHub.