{"record":{"id":"ccb1334879150f1e","repo":"windmill-labs/windmill","slug":"from-branch-is-for-converting-a-different-work","errorCode":null,"errorMessage":"--from-branch is for converting a *different* working branch into the fork branch, but you are already on \\`${currentBranch}\\`. Omit --from-branch to create a fresh fork branch with \\`git checkout -b\\`.","messagePattern":"--from-branch is for converting a \\*different\\* working branch into the fork branch, but you are already on \\\\`(.+?)\\\\`\\. Omit --from-branch to create a fresh fork branch with \\\\`git checkout -b\\\\`\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/workspace/fork.ts","lineNumber":64,"sourceCode":"  const originalBranchIfForked = getOriginalBranchForWorkspaceForks(currentBranch);\n\n  // A \"base branch\" is one we must not rename onto a fork branch: mapped to a\n  // workspace in wmill.yaml, or a conventional default (main/master).\n  const isBaseBranch = (branch: string): boolean =>\n    branch === \"main\" ||\n    branch === \"master\" ||\n    findWorkspaceByGitBranch(config.workspaces, branch) !== undefined;\n\n  // Decide the base branch the fork links to, and whether to rename the\n  // current working branch onto the fork branch. Auto-detected from where you\n  // are; `--from-branch` is the explicit/non-interactive override.\n  let clonedBranchName: string;\n  let renameCurrent: boolean;\n\n  if (opts.fromBranch) {\n    // Explicit override: base on <fromBranch>, rename the current branch.\n    if (opts.fromBranch === currentBranch) {\n      throw new Error(\n        `--from-branch is for converting a *different* working branch into the fork branch, but you are already on \\`${currentBranch}\\`. ` +\n        `Omit --from-branch to create a fresh fork branch with \\`git checkout -b\\`.`,\n      );\n    }\n    if (isBaseBranch(currentBranch)) {\n      throw new Error(\n        `Refusing to rename your current branch \\`${currentBranch}\\` — it looks like a base branch (mapped to a workspace in wmill.yaml, or main/master). ` +\n        `Check out the disposable working branch you want to convert first.`,\n      );\n    }\n    if (getOriginalBranchForWorkspaceForks(currentBranch)) {\n      // Current branch is itself a fork branch (wm-fork/<base>/<old-id>).\n      // Renaming it onto the new fork branch would detach the existing fork.\n      throw new Error(\n        `Refusing to rename your current branch \\`${currentBranch}\\` — it is already a fork branch. ` +\n        `To fork a fork, omit --from-branch: \\`wmill workspace fork\\` bases the new fork on this fork's original branch and creates a fresh fork branch without renaming.`,\n      );\n    }","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/workspace/fork.ts#L46-L82","documentation":"`--from-branch` explicitly means 'rename my current disposable working branch onto the new fork branch, basing it on <from-branch>'. Passing the branch you are currently standing on as `--from-branch` is contradictory: there is nothing different to convert. The CLI detects `opts.fromBranch === currentBranch` and throws before touching anything.","triggerScenarios":"Running `wmill workspace fork --from-branch <X>` while HEAD is already on branch X.","commonSituations":"Copy-pasting a command template that hardcodes the branch name; confusing --from-branch with the base branch you are already on; scripting the command with `$(git branch --show-current)` as the flag value.","solutions":["Omit `--from-branch` if you want a fresh fork branch created via git checkout -b","If you really want to convert the current branch, just run `wmill workspace fork` without the flag while on a non-base working branch","Pass a different branch (the base branch mapped to the parent workspace) as --from-branch"],"exampleFix":"// before\ngit switch feature-x\nwmill workspace fork --from-branch feature-x  # error\n// after\nwmill workspace fork  # omit --from-branch; converts feature-x into the fork branch","handlingStrategy":"validation","validationCode":"const current = execSync('git branch --show-current', { encoding: 'utf8' }).trim();\nif (opts.fromBranch && opts.fromBranch === current) {\n  throw new Error(`Omit --from-branch: you are already on ${current}.`);\n}\nawait createWorkspaceFork(opts, name);","typeGuard":"null","tryCatchPattern":"try {\n  await createWorkspaceFork(opts, name);\n} catch (e) {\n  if ((e as Error).message.includes('is for converting a *different* working branch')) {\n    console.error('Drop --from-branch or check out a different branch first.');\n  } else throw e;\n}","preventionTips":["Only pass --from-branch when the current branch differs from it","Don't script `--from-branch $(git branch --show-current)`","Remember --from-branch implies a rename of the current branch"],"tags":["git","cli","argument-validation"],"backgroundTag":"invalid-cli-argument","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"}