windmill-labs/windmill · info · Error

Fork cancelled. Check out a base branch to create a fresh fo

Error message

Fork cancelled. Check out a base branch to create a fresh fork branch instead.

What it means

In interactive mode, `resolveWorkingBranchBase` asks whether to base the fork on the current (non-base) branch and rename it. If the user selects 'No, cancel', the command aborts with this error rather than creating an unintended fork.

Source

Thrown at cli/src/commands/workspace/fork.ts:452

  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.");
  }

  const baseBranches = listConfiguredBaseBranches(config);
  if (baseBranches.length === 0) {
    throw new Error(
      `No base branches are configured in wmill.yaml's workspaces section, so the fork can't be linked to a parent. ` +
      `Add the parent workspace to wmill.yaml, or pass --from-branch <base>.`,
    );
  }
  if (baseBranches.length === 1) {
    log.info(`Basing the fork on \`${baseBranches[0]}\`.`);
    return baseBranches[0];
  }
  return await Select.prompt({
    message: "Which base branch is this fork based on (the parent)?",
    options: baseBranches.map((b) => ({ name: b, value: b })),
  });
}

View on GitHub (pinned to e474e8803c)

Solutions

  1. Check out a base branch (e.g. `git checkout main`) before running `wmill workspace fork`
  2. Re-run and answer 'Yes' if basing on the current branch is actually intended
  3. Use `--from-branch <base>` to skip the prompt

Example fix

// before (on feature/foo)
$ wmill workspace fork  # answered No
// after
git checkout main && wmill workspace fork
Defensive patterns

Strategy: validation

Validate before calling

if (!listConfiguredBaseBranches(config).includes(currentBranch)) {
  // prompt the user (or abort) before running wmill workspace fork
}

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 (e.message.includes('Fork cancelled')) {
    log.info('User declined; checkout a base branch and retry.');
  } else throw e;
}

Prevention

When it happens

Trigger: Running `wmill workspace fork` on a non-base branch in a TTY and answering 'No' to the 'base the fork on this branch and rename it?' prompt.

Common situations: User starts a fork from a feature branch by mistake, then declines the rename prompt expecting the tool to pick another branch automatically.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/635c5bc44f398eb5. Report an issue: GitHub.