windmill-labs/windmill · error · Error
You are on working branch \`${currentBranch}\`, which is not
Error message
You are on working branch \`${currentBranch}\`, which is not a base branch. Pass --from-branch <base> to base the fork on a base branch and rename this branch onto the fork branch, or check out a base branch and run \`wmill workspace fork\` to create a fresh fork branch. What it means
`wmill workspace fork` refuses to create a fork when the current git working branch is not one of the configured base branches and the command is running non-interactively (no TTY or --yes). Because it cannot prompt the user to confirm basing/rename, it throws to avoid silently forking off an unexpected branch.
Source
Thrown at cli/src/commands/workspace/fork.ts:436
- Use the Merge UI from the forked workspace home page
- Use git: ` + colors.white(`git checkout ${clonedBranchName} && git merge ${newBranchName} && wmill sync push`) + `
See: https://www.windmill.dev/docs/advanced/workspace_forks`);
}
/**
* When `wmill workspace fork` is run from a non-base working branch, confirm
* the user wants to turn it into a fork branch, and resolve which base branch
* the fork should be linked to. Throws in non-interactive mode (where the user
* must pass `--from-branch <base>` instead).
*/
async function resolveWorkingBranchBase(
config: Awaited<ReturnType<typeof readConfigFile>>,
opts: { yes?: boolean },
currentBranch: string,
): Promise<string> {
const interactive = process.stdin.isTTY && opts.yes !== true;
if (!interactive) {
throw new Error(
`You are on working branch \`${currentBranch}\`, which is not a base branch. ` +
`Pass --from-branch <base> to base the fork on a base branch and rename this branch onto the fork branch, ` +
`or check out a base branch and run \`wmill workspace fork\` to create a fresh fork branch.`,
);
}
const { Select } = await import("@cliffy/prompt/select");
const proceed = await Select.prompt({
message: `You're on working branch \`${currentBranch}\`, not a base branch. Base a fork on it and rename it onto the fork branch?`,
options: [
{ name: "Yes, base the fork on this branch and rename it", value: "yes" },
{ name: "No, cancel", value: "no" },
],
});
if (proceed !== "yes") {
throw new Error("Fork cancelled. Check out a base branch to create a fresh fork branch instead.");
}
View on GitHub (pinned to e474e8803c)
Solutions
- Pass `--from-branch <base>` so the fork is explicitly based on a base branch
- Check out a base branch before running `wmill workspace fork` to create a fresh fork branch
- Rename the current branch onto the fork branch, then re-run
- Run the command in an interactive terminal without --yes so the prompt can be answered
Example fix
// before wmill workspace fork --yes # fails on non-base branch // after wmill workspace fork --from-branch main
Defensive patterns
Strategy: validation
Validate before calling
const baseBranches = listConfiguredBaseBranches(config);
if (!baseBranches.includes(currentBranch) && !process.stdin.isTTY) {
// add --from-branch <base> before invoking
} Type guard
function isBaseBranch(branch: string, config: Config): boolean {
return listConfiguredBaseBranches(config).includes(branch);
} Try / catch
try {
await createWorkspaceFork(opts, config, currentBranch);
} catch (e) {
if (String(e.message).includes('not a base branch')) {
await createWorkspaceFork({ ...opts, fromBranch: 'main' }, config, currentBranch);
} else throw e;
} Prevention
- Always pass --from-branch when scripting fork creation
- Check `git branch --show-current` against configured base branches before calling
- Avoid --yes on non-base branches
When it happens
Trigger: Running `wmill workspace fork` (or `createWorkspaceFork` calling `resolveWorkingBranchBase`) while on a non-base branch, with `process.stdin.isTTY` false or `opts.yes === true`.
Common situations: CI/CD pipelines or scripts invoking `wmill workspace fork` while checked out on a feature branch; forgetting `--from-branch`; contributors branching off another feature branch instead of a base branch.
Related errors
- You can only create forks within a git repo. Forks are track
- Refusing to rename your current branch \`${currentBranch}\`
- This forked workspace '${workspaceId}' (${workspaceName}) al
- Fork cancelled. Check out a base branch to create a fresh fo
- No base branches are configured in wmill.yaml's workspaces s
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/ce22d0a1900a097c.
Report an issue: GitHub.