windmill-labs/windmill · error

Branch `${newBranchName}` already exists locally, so the cur

Error message

Branch `${newBranchName}` already exists locally, so the current branch `${currentBranch}` was not renamed. Check out the fork branch yourself (e.g. `git checkout ${newBranchName}`).

What it means

Error "Branch `${newBranchName}` already exists locally, so the current branch `${currentBranch}` was not renamed. Check out the fork branch yourself (e.g. `git checkout ${newBranchName}`)." thrown in windmill-labs/windmill.

Source

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

    );
    throw error;
  }


  const newBranchName = `${WM_FORK_PREFIX}/${clonedBranchName}/${workspaceId}`

  // Rename workflow: turn the current working branch into the fork branch in
  // place so its commits become the fork's. (Consent was already established —
  // by `--from-branch`, or the interactive prompt for a non-base branch.)
  // Otherwise: leave the user on their branch and have them check out a fresh
  // fork branch.
  let onForkBranch = false;
  if (renameCurrent) {
    if (currentBranch === newBranchName) {
      onForkBranch = true;
      log.info(colors.green(`Your current branch is already \`${newBranchName}\`.`));
    } else if (gitBranchExists(newBranchName)) {
      log.warn(
        `Branch \`${newBranchName}\` already exists locally, so the current branch \`${currentBranch}\` was not renamed. ` +
        `Check out the fork branch yourself (e.g. \`git checkout ${newBranchName}\`).`,
      );
    } else {
      renameCurrentGitBranch(newBranchName);
      onForkBranch = true;
      log.info(
        colors.green(
          `Renamed \`${currentBranch}\` → \`${newBranchName}\`. Your existing commits are now on the fork branch.`,
        ),
      );
    }
  }

  const checkoutHint = onForkBranch
    ? `Created forked workspace ${trueWorkspaceId}. You are on the fork branch \`${newBranchName}\` — push it to sync your fork.`
    : `Created forked workspace ${trueWorkspaceId}. To start contributing to your fork, create and push edits to the branch \`${newBranchName}\` by using the command:

View on GitHub (pinned to e474e8803c)

Solutions

  1. Check out the existing fork branch manually: git checkout <fork-branch-name>
  2. Delete or rename the pre-existing conflicting local branch, then re-run the fork command
  3. Inspect both branches with git log --oneline to decide which to keep
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at cli/src/commands/workspace/fork.ts:391 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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