{"record":{"id":"ce22d0a1900a097c","repo":"windmill-labs/windmill","slug":"you-are-on-working-branch-currentbranch-wh","errorCode":null,"errorMessage":"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.","messagePattern":"You are on working branch \\\\`(.+?)\\\\`, 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\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/workspace/fork.ts","lineNumber":436,"sourceCode":"  - Use the Merge UI from the forked workspace home page\n  - Use git: ` + colors.white(`git checkout ${clonedBranchName} && git merge ${newBranchName} && wmill sync push`) + `\n  See: https://www.windmill.dev/docs/advanced/workspace_forks`);\n}\n\n/**\n * When `wmill workspace fork` is run from a non-base working branch, confirm\n * the user wants to turn it into a fork branch, and resolve which base branch\n * the fork should be linked to. Throws in non-interactive mode (where the user\n * must pass `--from-branch <base>` instead).\n */\nasync function resolveWorkingBranchBase(\n  config: Awaited<ReturnType<typeof readConfigFile>>,\n  opts: { yes?: boolean },\n  currentBranch: string,\n): Promise<string> {\n  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","sourceCodeStart":418,"sourceCodeEnd":454,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/workspace/fork.ts#L418-L454","documentation":"`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.","triggerScenarios":"Running `wmill workspace fork` (or `createWorkspaceFork` calling `resolveWorkingBranchBase`) while on a non-base branch, with `process.stdin.isTTY` false or `opts.yes === true`.","commonSituations":"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.","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"],"exampleFix":"// before\nwmill workspace fork --yes   # fails on non-base branch\n// after\nwmill workspace fork --from-branch main","handlingStrategy":"validation","validationCode":"const baseBranches = listConfiguredBaseBranches(config);\nif (!baseBranches.includes(currentBranch) && !process.stdin.isTTY) {\n  // add --from-branch <base> before invoking\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 (String(e.message).includes('not a base branch')) {\n    await createWorkspaceFork({ ...opts, fromBranch: 'main' }, config, currentBranch);\n  } else throw e;\n}","preventionTips":["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"],"tags":["cli","git-branch","workspace-fork","non-interactive"],"backgroundTag":"non-base-working-branch","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"}