jesseduffield/lazygit · warning

This does not seem to be a git flow branch

Error message

This does not seem to be a git flow branch

What it means

FinishCmdObj (git flow finish) errors when the branch name contains no '/' separator, or the part before '/' is empty. The git-flow branch type is derived from the prefix before the slash, so a branch like 'main' or '/foo' has no flow type at all.

Source

Thrown at pkg/commands/git_commands/flow.go:31

func NewFlowCommands(
	gitCommon *GitCommon,
) *FlowCommands {
	return &FlowCommands{
		GitCommon: gitCommon,
	}
}

func (self *FlowCommands) GitFlowEnabled() bool {
	return len(self.config.GetGitFlowPrefixMap()) > 0
}

func (self *FlowCommands) FinishCmdObj(branchName string) (*oscommands.CmdObj, error) {
	prefixMap := self.config.GetGitFlowPrefixMap()

	prefixPart, suffix, ok := strings.Cut(branchName, "/")
	if !ok || prefixPart == "" || suffix == "" {
		return nil, errors.New(self.Tr.NotAGitFlowBranch)
	}
	prefix := prefixPart + "/"

	branchType := prefixMap[prefix]
	if branchType == "" {
		return nil, errors.New(self.Tr.NotAGitFlowBranch)
	}

	cmdArgs := NewGitCmd("flow").Arg(branchType, "finish", suffix).ToArgv()

	return self.cmd.New(cmdArgs), nil
}

func (self *FlowCommands) StartCmdObj(branchType string, name string) *oscommands.CmdObj {
	cmdArgs := NewGitCmd("flow").Arg(branchType, "start", name).ToArgv()

	return self.cmd.New(cmdArgs)
}

View on GitHub (pinned to c477a2959b)

Solutions

  1. Only run finish on branches named <type>/<name>, e.g. feature/x, release/1.0
  2. If you meant to delete/merge a normal branch, use the branch panel's delete/merge actions instead of git flow finish
  3. Initialize git flow in the repo (`git flow init`) so naming conventions are established

Example fix

# before
git flow finish on branch 'main'  -> error

# after
# switch to a flow branch first
git checkout feature/my-feature   then run finish
Defensive patterns

Strategy: validation

Validate before calling

prefixPart, suffix, ok := strings.Cut(branchName, "/")
if !ok || prefixPart == "" || suffix == "" {
    return fmt.Errorf("branch %q has no git-flow <type>/<name> shape", branchName)
}
// safe to call FinishCmdObj

Try / catch

Catch by checking Tr.NotAGitFlowBranch equality at the call site and degrade gracefully: disable the finish action for branches without a slash instead of showing the raw error.

Prevention

When it happens

Trigger: Invoking the finish action on a branch without a slash (e.g. 'master', 'main'); a branch literally named '/suffix' or 'prefix/' where one side of the Cut is empty.

Common situations: Keybinding/menu mapped to git-flow finish hit while a non-flow branch is selected; stale selection after switching branches; muscle-memory on projects that don't use git-flow.

Related errors


AI-assisted analysis of jesseduffield/lazygit@c477a2959b (2026-08-15). Data as JSON: /api/errors/0b93162e950dd10d. Report an issue: GitHub.