kovidgoyal/kitty · error
There are %d leftover bytes in the delta
Error message
There are %d leftover bytes in the delta
What it means
After applying a delta, FinishDelta found unconsumed delta bytes — the delta stream length doesn't align with the operation records, indicating truncation or corruption.
Source
Thrown at tools/rsync/api.go:183
// Apply a chunk of delta data
func (self *Patcher) UpdateDelta(data []byte) (err error) {
self.unconsumed_delta_data = append(self.unconsumed_delta_data, data...)
consumed, err := self.update_delta(self.unconsumed_delta_data)
if err != nil {
return err
}
self.unconsumed_delta_data = utils.ShiftLeft(self.unconsumed_delta_data, consumed)
return
}
// Finish applying delta data
func (self *Patcher) FinishDelta() (err error) {
if err = self.UpdateDelta([]byte{}); err != nil {
return err
}
if len(self.unconsumed_delta_data) > 0 {
return fmt.Errorf("There are %d leftover bytes in the delta", len(self.unconsumed_delta_data))
}
self.delta_input = nil
self.delta_output = nil
self.unconsumed_delta_data = nil
if !self.rsync.checksum_done {
return fmt.Errorf("The checksum was not received at the end of the delta data")
}
return
}
// Create a signature for the data source in src.
func (self *Patcher) CreateSignatureIterator(src io.Reader, output io.Writer) func() error {
var it func() (BlockHash, error)
finished := false
var b [BlockHashSize]byte
return func() error {
if finished {
return io.EOFView on GitHub (pinned to 6d5d0c4406)
Solutions
- Ensure all delta chunks were passed to UpdateDelta before FinishDelta
- Verify the transport framing (lengths/pipes) delivers the complete byte stream
- Re-request the delta from the sender
Defensive patterns
Strategy: try-catch
Try / catch
if err := patcher.FinishDelta(); err != nil { discard patched output; re-request delta and reapply } Prevention
- Ensure the delta iterator on the sender completes before finishing on the receiver
- Verify transfer byte counts match between sender and receiver
When it happens
Trigger: Calling FinishDelta after UpdateDelta received a byte count that ends mid-operation; e.g. a network read cut short or extra bytes appended.
Common situations: Interrupted transfers, misframed pipes, or feeding the patcher partial chunks and finishing too early.
Related errors
- There were %d leftover bytes in the signature data
- Invalid weak_hash in signature header: %d
- rsync signature header has zero block size
- rsync signature header has too large block size %d > %d
- The checksum was not received at the end of the delta data
AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27).
Data as JSON: /api/errors/b141a4c24535377e.
Report an issue: GitHub.