HelloZeroNet/ZeroNet · error · VerifyError

File size does not match %s <> %s

Error message

File size does not match %s <> %s

What it means

VerifyError raised in verifyFile's sha512 verification branch when the actual byte length of the file on disk (file.tell()) differs from the 'size' recorded for it in content.json. It indicates the local file is truncated, corrupted, or out of sync with the signed manifest; the input at fault is the mismatched file content versus file_info['size'].

Source

Thrown at src/Content/ContentManager.py:1015

                    if valid_signs < signs_required:
                        raise VerifyError("Valid signs: %s/%s" % (valid_signs, signs_required))
                    else:
                        return self.verifyContent(inner_path, new_content)
                else:  # Old style signing
                    raise VerifyError("Invalid old-style sign")

            except Exception as err:
                self.log.warning("%s: verify sign error: %s" % (inner_path, Debug.formatException(err)))
                raise err

        else:  # Check using sha512 hash
            file_info = self.getFileInfo(inner_path)
            if file_info:
                if CryptHash.sha512sum(file) != file_info.get("sha512", ""):
                    raise VerifyError("Invalid hash")

                if file_info.get("size", 0) != file.tell():
                    raise VerifyError(
                        "File size does not match %s <> %s" %
                        (inner_path, file.tell(), file_info.get("size", 0))
                    )

                return True

            else:  # File not in content.json
                raise VerifyError("File not in content.json")

    def optionalDelete(self, inner_path):
        self.site.storage.delete(inner_path)

    def optionalDownloaded(self, inner_path, hash_id, size=None, own=False):
        if size is None:
            size = self.site.storage.getSize(inner_path)

        done = self.hashfield.appendHashId(hash_id)
        self.site.settings["optional_downloaded"] += size

View on GitHub (pinned to 454c0b2e7e)

Solutions

  1. Re-download the file from peers to replace the corrupted/truncated local copy
  2. Rebuild or re-sign content.json if the file was legitimately changed (update size field)
  3. Catch VerifyError in isModified and treat the file as modified/invalid so it gets refetched
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/Content/ContentManager.py:1015 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of HelloZeroNet/ZeroNet@454c0b2e7e (2026-09-02). Data as JSON: /api/errors/9a06de2b6e3957c9. Report an issue: GitHub.