Skip to content

[Bug] Code review fails with "FileDiff: loadDiffFiles is required" when expandUnchanged is on (@pierre/diffs 1.5.2) #2264

Closed

Description

@thomasaull

What happened?

Code review does not open. The page fails with this error:

Uncaught Error: FileDiff: loadDiffFiles is required to load full files for a partial diff

Setup: the review is opened from Pi with the diff type since-base and diffOptions.expandUnchanged: true in ~/.plannotator/config.json. The working tree is large, with about 80 changed paths, some staged and some unstaged.

Probable cause

  • PR chore(deps): bun minor and patch group (takes over #2146), one KaTeX, one CodeMirror #2152 (released in 0.28.31) moved @pierre/diffs from 1.3.6 to 1.5.2.
  • In 1.5.2, FileDiff.loadFilesIfNecessary() throws when the diff is partial (isPartial and type change / rename-*) and options.loadDiffFiles is not set. It runs on render() when expandUnchanged is on, and also from expandHunk(), revealLine() and updateExternalDiff().
  • Plannotator never passes loadDiffFiles. It loads the full file itself through /api/file-content. When that does not work, the file stays partial: no content is returned, or the content does not match the patch ("file changed since the diff was captured"). With expandUnchanged on, the library then throws, and the page fails.

Workaround

Set "expandUnchanged": false in ~/.plannotator/config.json. Also clear the plannotator-diff-expand-unchanged key in the browser storage if it is set there. Clicking "expand" on such a file can probably still cause the same error.

Possible fix

  • Pass a loadDiffFiles callback that uses /api/file-content, or
  • do not set expandUnchanged (and hide the expand controls) for diffs that are still partial.

Same bug in another project: anomalyco/opencode#52263 (and #52213). OpenCode Desktop broke the same way after it moved to the same @pierre/diffs version.

Versions

  • @plannotator/pi-extension 0.28.33 (@pierre/diffs 1.5.2)
  • plannotator CLI 0.28.21

I found the cause with an AI agent by reading the shipped review-editor.html bundle and @pierre/diffs/dist/components/FileDiff.js. I did not build a minimal repro.

Plannotator version

0.28.33 (pi extension); CLI 0.28.21

OS

Linux

Agent

Pi

Where did it happen?

Code review

Activity

  1. PassionZale commented on Oct 29, 2026

    @PassionZale
    Image
  2. added
    bug
    on Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions