{"record":{"id":"635c5bc44f398eb5","repo":"windmill-labs/windmill","slug":"fork-cancelled-check-out-a-base-branch-to-create","errorCode":null,"errorMessage":"Fork cancelled. Check out a base branch to create a fresh fork branch instead.","messagePattern":"Fork cancelled\\. Check out a base branch to create a fresh fork branch instead\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"info","filePath":"cli/src/commands/workspace/fork.ts","lineNumber":452,"sourceCode":"  const interactive = process.stdin.isTTY && opts.yes !== true;\n  if (!interactive) {\n    throw new Error(\n      `You are on working branch \\`${currentBranch}\\`, which is not a base branch. ` +\n      `Pass --from-branch <base> to base the fork on a base branch and rename this branch onto the fork branch, ` +\n      `or check out a base branch and run \\`wmill workspace fork\\` to create a fresh fork branch.`,\n    );\n  }\n\n  const { Select } = await import(\"@cliffy/prompt/select\");\n  const proceed = await Select.prompt({\n    message: `You're on working branch \\`${currentBranch}\\`, not a base branch. Base a fork on it and rename it onto the fork branch?`,\n    options: [\n      { name: \"Yes, base the fork on this branch and rename it\", value: \"yes\" },\n      { name: \"No, cancel\", value: \"no\" },\n    ],\n  });\n  if (proceed !== \"yes\") {\n    throw new Error(\"Fork cancelled. Check out a base branch to create a fresh fork branch instead.\");\n  }\n\n  const baseBranches = listConfiguredBaseBranches(config);\n  if (baseBranches.length === 0) {\n    throw new Error(\n      `No base branches are configured in wmill.yaml's workspaces section, so the fork can't be linked to a parent. ` +\n      `Add the parent workspace to wmill.yaml, or pass --from-branch <base>.`,\n    );\n  }\n  if (baseBranches.length === 1) {\n    log.info(`Basing the fork on \\`${baseBranches[0]}\\`.`);\n    return baseBranches[0];\n  }\n  return await Select.prompt({\n    message: \"Which base branch is this fork based on (the parent)?\",\n    options: baseBranches.map((b) => ({ name: b, value: b })),\n  });\n}","sourceCodeStart":434,"sourceCodeEnd":470,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/workspace/fork.ts#L434-L470","documentation":"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.","triggerScenarios":"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.","commonSituations":"User starts a fork from a feature branch by mistake, then declines the rename prompt expecting the tool to pick another branch automatically.","solutions":["Check out a base branch (e.g. `git checkout main`) before running `wmill workspace fork`","Re-run and answer 'Yes' if basing on the current branch is actually intended","Use `--from-branch <base>` to skip the prompt"],"exampleFix":"// before (on feature/foo)\n$ wmill workspace fork  # answered No\n// after\ngit checkout main && wmill workspace fork","handlingStrategy":"validation","validationCode":"if (!listConfiguredBaseBranches(config).includes(currentBranch)) {\n  // prompt the user (or abort) before running wmill workspace fork\n}","typeGuard":"function isBaseBranch(branch: string, config: Config): boolean {\n  return listConfiguredBaseBranches(config).includes(branch);\n}","tryCatchPattern":"try {\n  await createWorkspaceFork(opts, config, currentBranch);\n} catch (e) {\n  if (e.message.includes('Fork cancelled')) {\n    log.info('User declined; checkout a base branch and retry.');\n  } else throw e;\n}","preventionTips":["Start fork commands from a base branch","Answer the prompt deliberately; cancelling aborts with this error","Use --from-branch to skip the prompt in scripts"],"tags":["cli","git-branch","user-cancelled"],"backgroundTag":"fork-operation-cancelled","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}