Error guide

Fixing “Source File Too Short” in xdelta3 and Delta Patcher

“An error has occurred: xdelta3: source file too short: XD3_INVALID_INPUT” means the patch tried to read data past the end of your original file. The patch is fine; your file is smaller than the one it was made from. Here’s how to find out why and get the right file.

  • Updated
  • Checked against Delta Patcher 3.1.6
  • 4 min read
  • Verified against primary sources · how we check

In short

  • The patch copies data from a position your file doesn’t reach, so your file is smaller than the original the patch was made from.
  • Delta Patcher shows this as “The file you are trying to patch is not the right one.” The log has the exact message.
  • Usual causes: a trimmed DS ROM, a SNES ROM without its header, the wrong disc or track, an incomplete download, or a different revision.
  • The patch inspector shows the minimum size the patch reads and compares your file with it.

What the error looks like

In Delta Patcher 3.1.2 and later, the dialog says:

The patch could not be applied:
The file you are trying to patch is not the right one.

Open the log (the button at the bottom right) for the underlying message:

Delta Patcher log
An error has occurred: xdelta3: source file too short: XD3_INVALID_INPUT

The xdelta3 command line prints xdelta3: source file too short: XD3_INVALID_INPUT. Online patchers built on xdelta3 show the same words.

What it means

An XDelta patch rebuilds the new file from two ingredients: new bytes stored in the patch, and instructions like “copy 4,096 bytes from position 7,340,032 of the original”. xdelta3 raises source file too short when one of those copy instructions points beyond the end of your file. In the xdelta3 source, the check sits exactly where the decoder reads a block of the source and finds fewer bytes than the instruction needs.

So the patch has told you something precise: the author’s original was longer than yours. That narrows the search a lot compared with a checksum mismatch, where the sizes can be identical.

Why your file is smaller

Why an original file comes out smaller than the patch expects
PlatformTypical causeWhat to look for
Nintendo DSA trimmed ROM: padding at the end was removed to save spaceTrimmed files are usually not a round size; untrimmed dumps are a power of two (64, 128, 256, 512 MB)
SNESThe patch was made for a headered ROM (512 extra bytes) and yours is unheaderedFile size divided by 1,024 leaves a remainder of 512 when a header is present. See the SNES guide
PlayStation, PSP, GameCube, WiiWrong disc, a single track instead of the full image, or a compressed format (CSO, CHD, RVZ)Compare the file size with the one in the readme; convert compressed images back to ISO/BIN first
AnyAn incomplete download or copyRe-download or re-copy and compare the size again
AnyA different revision or region that happens to be shorterCheck the version in the readme. How to identify versions

The fix sequence

  1. Find the size the patch needs

    Drop the patch into the patch inspector. It reads the patch’s windows and shows how far into the original it reads, plus the source file name xdelta3 recorded if the author left it in. Many readmes also state the expected size or checksum.

  2. Compare with your file

    Check your file’s exact size in bytes (file properties on Windows, Get Info on macOS, ls -l on Linux). If it’s smaller than the inspector’s figure, you have confirmed the cause.

  3. Get the full, matching original

    Use an untrimmed dump, add or keep the header the patch expects, extract the complete disc image, or redownload the file. Then check its checksum against the readme.

  4. Patch a copy with validation on

    Apply the patch again with Checksum validation on and Backup original file ticked, in Delta Patcher or the online patcher.

What won’t fix it

  • Turning off checksum validation. This error isn’t a checksum check; the data the patch needs simply isn’t in your file.
  • Padding the file with zeros. Occasionally this works for a trimmed DS ROM whose missing tail really was padding, but if the patch copies real data from that region the result will be wrong. Get a proper dump instead.
  • Trying another patcher. Every xdelta-compatible patcher needs the same bytes.

Frequently asked questions

My file is bigger than the patch needs. Can it still be wrong?

Yes. A larger file passes the size check but can still contain different bytes, which ends in a target window checksum mismatch. Size only rules files out.

Is “source file too short” ever caused by the patch?

Very rarely. An incomplete patch file fails with other messages, such as eof in decode. This message specifically means the patch asked for source data you don’t have.

Does Delta Patcher’s version matter?

Not for this error. Every version needs the same original. Versions before 3.1.5 couldn’t open files larger than 4 GB, which produces a different failure. Use the current release for big disc images.

Continue learning

Sources and references