{"record":{"id":"9a06de2b6e3957c9","repo":"HelloZeroNet/ZeroNet","slug":"file-size-does-not-match-s-s","errorCode":null,"errorMessage":"File size does not match %s <> %s","messagePattern":"File size does not match (.+?) <> (.+?)","errorType":"validation","errorClass":"VerifyError","httpStatus":null,"severity":"error","filePath":"src/Content/ContentManager.py","lineNumber":1015,"sourceCode":"                    if valid_signs < signs_required:\n                        raise VerifyError(\"Valid signs: %s/%s\" % (valid_signs, signs_required))\n                    else:\n                        return self.verifyContent(inner_path, new_content)\n                else:  # Old style signing\n                    raise VerifyError(\"Invalid old-style sign\")\n\n            except Exception as err:\n                self.log.warning(\"%s: verify sign error: %s\" % (inner_path, Debug.formatException(err)))\n                raise err\n\n        else:  # Check using sha512 hash\n            file_info = self.getFileInfo(inner_path)\n            if file_info:\n                if CryptHash.sha512sum(file) != file_info.get(\"sha512\", \"\"):\n                    raise VerifyError(\"Invalid hash\")\n\n                if file_info.get(\"size\", 0) != file.tell():\n                    raise VerifyError(\n                        \"File size does not match %s <> %s\" %\n                        (inner_path, file.tell(), file_info.get(\"size\", 0))\n                    )\n\n                return True\n\n            else:  # File not in content.json\n                raise VerifyError(\"File not in content.json\")\n\n    def optionalDelete(self, inner_path):\n        self.site.storage.delete(inner_path)\n\n    def optionalDownloaded(self, inner_path, hash_id, size=None, own=False):\n        if size is None:\n            size = self.site.storage.getSize(inner_path)\n\n        done = self.hashfield.appendHashId(hash_id)\n        self.site.settings[\"optional_downloaded\"] += size","sourceCodeStart":997,"sourceCodeEnd":1033,"githubUrl":"https://github.com/HelloZeroNet/ZeroNet/blob/454c0b2e7e000fda7000cba49027541fbf327b96/src/Content/ContentManager.py#L997-L1033","documentation":"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'].","triggerScenarios":"Thrown at src/Content/ContentManager.py:1015 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-download the file from peers to replace the corrupted/truncated local copy","Rebuild or re-sign content.json if the file was legitimately changed (update size field)","Catch VerifyError in isModified and treat the file as modified/invalid so it gets refetched"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"454c0b2e7e000fda7000cba49027541fbf327b96","analyzedAt":"2026-09-02T19:46:57.278Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}