{"record":{"id":"82e8340366fd77a1","repo":"HelloZeroNet/ZeroNet","slug":"unable-to-download-piecemap-s","errorCode":null,"errorMessage":"Unable to download piecemap: %s","messagePattern":"Unable to download piecemap: (.+?)","errorType":"exception","errorClass":"VerifyError","httpStatus":null,"severity":"error","filePath":"plugins/Bigfile/BigfilePlugin.py","lineNumber":395,"sourceCode":"        self.optionalDownloaded(inner_path, hash_id, file_size, own=True)\n        self.site.storage.piecefields[hash].frombytes(b\"\\x01\" * piece_num)\n\n        back[file_relative_path] = {\"sha512\": hash, \"size\": file_size, \"piecemap\": piecemap_relative_path, \"piece_size\": piece_size}\n        return back\n\n    def getPiecemap(self, inner_path):\n        file_info = self.site.content_manager.getFileInfo(inner_path)\n        piecemap_inner_path = helper.getDirname(file_info[\"content_inner_path\"]) + file_info[\"piecemap\"]\n        self.site.needFile(piecemap_inner_path, priority=20)\n        piecemap = Msgpack.unpack(self.site.storage.open(piecemap_inner_path, \"rb\").read())[helper.getFilename(inner_path)]\n        piecemap[\"piece_size\"] = file_info[\"piece_size\"]\n        return piecemap\n\n    def verifyPiece(self, inner_path, pos, piece):\n        try:\n            piecemap = self.getPiecemap(inner_path)\n        except Exception as err:\n            raise VerifyError(\"Unable to download piecemap: %s\" % Debug.formatException(err))\n\n        piece_i = int(pos / piecemap[\"piece_size\"])\n        if CryptHash.sha512sum(piece, format=\"digest\") != piecemap[\"sha512_pieces\"][piece_i]:\n            raise VerifyError(\"Invalid hash\")\n        return True\n\n    def verifyFile(self, inner_path, file, ignore_same=True):\n        if \"|\" not in inner_path:\n            return super(ContentManagerPlugin, self).verifyFile(inner_path, file, ignore_same)\n\n        inner_path, file_range = inner_path.split(\"|\")\n        pos_from, pos_to = map(int, file_range.split(\"-\"))\n\n        return self.verifyPiece(inner_path, pos_from, file)\n\n    def optionalDownloaded(self, inner_path, hash_id, size=None, own=False):\n        if \"|\" in inner_path:\n            inner_path, file_range = inner_path.split(\"|\")","sourceCodeStart":377,"sourceCodeEnd":413,"githubUrl":"https://github.com/HelloZeroNet/ZeroNet/blob/454c0b2e7e000fda7000cba49027541fbf327b96/plugins/Bigfile/BigfilePlugin.py#L377-L413","documentation":"Bigfile verification splits large files into pieces and relies on a separate '<content>.piecemap.msgpack' file holding the per-piece sha512 hashes. verifyPiece() calls getPiecemap() to fetch that piecemap; if downloading it fails for any reason, the piece cannot be verified and the original error is wrapped in a VerifyError.","triggerScenarios":"verifyFile()/verifyPiece() on a big file whose piecemap file is missing from the site/peers, the tracker/peers are unreachable, or the piecemap download throws (timeout, not found, corrupted).","commonSituations":"Seeding a big file without uploading the generated .piecemap.msgpack; site opened with no peers online; deleted piecemap after regenerating content; network/firewall blocking peer connections.","solutions":["Ensure the '<inner_path>.piecemap.msgpack' file exists in the site content.json and is signed/seeded alongside the big file","Check peer connectivity — open the site and let it find peers, or run a seed node, then retry verification","If the piecemap is lost, rebuild it by re-packing the big file (Bigfile pack/build) and update content.json","Read the wrapped cause after 'Unable to download piecemap:' to see the underlying network/error and fix that first"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"# before verification, confirm piecemap is published\npiecemap_path = inner_path + '.piecemap.msgpack'\nassert piecemap_path in site.content_manager.contents['content.json']['files'], 'piecemap not in content.json'","typeGuard":null,"tryCatchPattern":"try:\n    site.verifyFile(bigfile_inner_path, f)\nexcept VerifyError as err:\n    if 'Unable to download piecemap' in str(err):\n        wait_for_peers_and_retry(inner_path)  # exponential backoff\n    else:\n        raise","preventionTips":["Always publish <file>.piecemap.msgpack together with the big file in content.json","Keep at least one seeder online; verify shortly after opening the site so peers connect","Read the wrapped cause in the message to fix the underlying network issue","After repacking a big file, re-sign and re-upload content.json before verifying"],"tags":["network","verification","bigfile","piecemap"],"backgroundTag":"piecemap-download-failed","analyzedSha":"454c0b2e7e000fda7000cba49027541fbf327b96","analyzedAt":"2026-09-02T19:46:57.278Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}