jesseduffield/lazygit · warning

Entire file

Error message

Entire file

What it means

Internal sentinel returned inside FixupHelper.blameDeletedLines (marked TODO i18n) when a deleted-lines hunk starts at line 0 AND blaming the line after the hunk fails: the hunk spans the entire file, so there is no context line before or after to attribute the deletion to a base commit. The message 'Entire file' is a developer-facing placeholder, not a polished user-facing string.

Source

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

				if err != nil {
					return err
				}
				appendBlamedLine(blameOutput)
			}

			// Blame the line after this hunk. We don't know how many lines the
			// file has, so we can't check if there is a line after the hunk;
			// let the error tell us.
			blameOutput, err := self.c.Git().Blame.BlameLineRange(h.filename, "HEAD", h.startLineIdx+1, 1)
			if err != nil {
				// If this fails, we're probably at the end of the file (we
				// could have checked this beforehand, but it's expensive). If
				// there was a line before this hunk, this is fine, we'll just
				// return that one; if not, the hunk encompasses the entire
				// file, and we can't blame the lines before and after the hunk.
				// This is an error.
				if h.startLineIdx == 0 {
					return errors.New("Entire file") // TODO i18n
				}
			} else {
				appendBlamedLine(blameOutput)
			}

			hashesChan <- result
			return nil
		})
	}

	go func() {
		// We don't care about the error here, we'll check it later (in the
		// return statement below). Here we only wait for all the goroutines to
		// finish so that we can close the channel.
		_ = errg.Wait()
		close(hashesChan)
	}()

View on GitHub (pinned to c477a2959b)

Solutions

  1. Fixup does not support whole-file deletions; commit the deletion normally (it is a new change, not an amendment).
  2. If the file was added by mistake in the branch's last commit, use amend or drop that commit instead.

Example fix

// before
if h.startLineIdx == 0 {
    return errors.New("Entire file") // TODO i18n
}

// after
if h.startLineIdx == 0 {
    return errors.New(self.c.Tr.FixupEntireFileNotSupported) // add to english.go
}
Defensive patterns

Strategy: fallback

Validate before calling

// detect whole-file hunks up front:
if h.startLineIdx == 0 && hunkSpansRestOfFile { /* commit normally; fixup unsupported */ }

Prevention

When it happens

Trigger: Invoking fixup on a deleted file/hunk where the deletion begins at line 1 and the file has no trailing line after the hunk — e.g. selecting the whole-file deletion of a newly added file and pressing shift-F.

Common situations: Deleting an entire file that was added in an earlier commit on the branch and trying to fixup that deletion; whole-file replacements pasted over the original content.

Related errors


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