jesseduffield/lazygit · warning

No base commits found

Error message

No base commits found

What it means

Returned in two places in FixupHelper when blame succeeded as a process but produced no usable base-commit hashes: (a) after blaming, len(hashes)==0 — marked 'should never happen'; (b) in blameAddedLines when two candidate hashes are found but neither exists in the loaded commit model. The error distinguishes 'blame ran but identified nothing attributable' from the not-in-view and already-on-main cases.

Source

Thrown at pkg/gui/controllers/helpers/fixup_helper.go:73

	var hashes []string
	warnAboutAddedLines := false

	if len(deletedLineHunks) > 0 {
		hashes, err = self.blameDeletedLines(deletedLineHunks)
		warnAboutAddedLines = len(addedLineHunks) > 0
	} else if len(addedLineHunks) > 0 {
		hashes, err = self.blameAddedLines(commits, addedLineHunks)
	} else {
		return errors.New(self.c.Tr.NoChangedFiles)
	}

	if err != nil {
		return err
	}

	if len(hashes) == 0 {
		// This should never happen
		return errors.New(self.c.Tr.NoBaseCommitsFound)
	}

	// If a commit can't be found, and the last known commit is already merged,
	// we know that the commit we're looking for is also merged. Otherwise we
	// can't tell.
	notFoundMeansMerged := len(commits) > 0 && commits[len(commits)-1].Status == models.StatusMerged

	const (
		MERGED int = iota
		NOT_MERGED
		CANNOT_TELL
	)

	// Group the hashes into buckets by merged status
	hashGroups := lo.GroupBy(hashes, func(hash string) int {
		commit, _, ok := self.findCommit(commits, hash)
		if ok {
			return lo.Ternary(commit.Status == models.StatusMerged, MERGED, NOT_MERGED)

View on GitHub (pinned to c477a2959b)

Solutions

  1. Increase the commit window by scrolling/loading more commits in the Commits panel, then retry.
  2. Run 'git log -S' or 'git blame' on the line manually to see which commit actually introduced it.
  3. If the base is a merge or root commit, create a normal commit instead of a fixup.
Defensive patterns

Strategy: fallback

Validate before calling

// pre-check that candidate hashes are within the loaded model:
if _, _, ok := findCommit(commits, hash); !ok {
    // load more history or fall back to manual git commit --fixup
}

Prevention

When it happens

Trigger: Selecting changed lines whose blame returns boundary commits (root commit '^' pseudo-hash) or hashes from other branches that the current commits model (last 300 commits) does not contain; pathological empty blame output.

Common situations: Long-lived branches where the touched line predates the model's commit window; lines introduced by a merge commit itself; shallow clones where history is truncated.

Related errors


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