{"record":{"id":"82bad269dd1b80a2","repo":"theonedev/onedev","slug":"blob-not-found-s","errorCode":null,"errorMessage":"Blob not found: %s","messagePattern":"Blob not found: (.+?)","errorType":"validation","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/service/impl/DefaultPackBlobService.java","lineNumber":456,"sourceCode":"\t\t\t\treturn new Pair<>(packBlob.getId(), false);\n\t\t\t} else {\n\t\t\t\treturn new Pair<>(packBlob.getId(), true);\n\t\t\t}\n\t\t});\n\t}\n\n\t@Override\n\tpublic byte[] readBlob(Long projectId, String sha256Hash) {\n\t\tvar packBlob = findBySha256Hash(projectId, sha256Hash);\n\t\tif (packBlob != null) {\n\t\t\tvar baos = new ByteArrayOutputStream();\n\t\t\tdownloadBlob(projectId, sha256Hash, baos);\n\t\t\tvar bytes = baos.toByteArray();\n\t\t\tif (bytes.length != packBlob.getSize())\n\t\t\t\tthrow new ExplicitException(\"Invalid blob size: \" + sha256Hash);\n\t\t\treturn bytes;\n\t\t} else {\n\t\t\tthrow new ExplicitException(\"Blob not found: \" + sha256Hash);\n\t\t}\n\t}\n\n\t@Override\n\tpublic void downloadBlob(Long projectId, String sha256Hash, OutputStream os) {\n\t\tvar activeServer = projectService.getActiveServer(projectId, true);\n\t\tif (activeServer.equals(clusterService.getLocalServerAddress())) {\n\t\t\tread(getFileLockName(projectId, sha256Hash), () -> {\n\t\t\t\ttry (var is = new FileInputStream(getPackBlobFile(projectId, sha256Hash))) {\n\t\t\t\t\tcopy(is, os, BUFFER_SIZE);\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t});\n\t\t} else {\n\t\t\tClient client = ClientBuilder.newClient();\n\t\t\ttry {\n\t\t\t\tString serverUrl = clusterService.getServerUrl(activeServer);\n\t\t\t\tWebTarget target = client.target(serverUrl).path(\"~api/cluster/pack-blob\")","sourceCodeStart":438,"sourceCodeEnd":474,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/service/impl/DefaultPackBlobService.java#L438-L474","documentation":"DefaultPackBlobService.readBlob throws this ExplicitException when findBySha256Hash finds no pack blob record for the given sha256 hash in the project, meaning the requested blob was never published to (or has been removed from) this project's package storage.","triggerScenarios":"Calling PackBlobService.readBlob(projectId, sha256Hash) with a hash that does not exist in the project's pack blob table — wrong hash, blob deleted, or wrong projectId used.","commonSituations":"Client cached a blob reference from a package that was later deleted; copying blob URLs between projects/environments (test vs prod server); typo/truncation of the sha256 hash; garbled collection pruning the blob while a manifest still references it.","solutions":["Verify the sha256 hash is correct and belongs to this project (query the pack blob list first)","Re-publish the package that contains the blob","Check you are hitting the correct project and server instance","Remove stale references to the deleted blob from manifests/consumers"],"exampleFix":"// before: unconditional read\nbyte[] data = packBlobService.readBlob(projectId, sha256Hash);\n// after: check existence first\nif (packBlobService.findBlob(projectId, sha256Hash) == null) {\n    throw new ExplicitException(\"Blob \" + sha256Hash + \" not published to project \" + projectId);\n}\nbyte[] data = packBlobService.readBlob(projectId, sha256Hash);","handlingStrategy":"try-catch","validationCode":"var blob = packBlobService.findBySha256Hash(projectId, sha256Hash);\nif (blob == null) {\n    throw new ExplicitException(\"Blob \" + sha256Hash + \" does not exist in project \" + projectId);\n}","typeGuard":"function blobExists(packBlobService, projectId, sha256Hash) {\n    return packBlobService.findBySha256Hash(projectId, sha256Hash) != null;\n}","tryCatchPattern":"try {\n    return packBlobService.readBlob(projectId, sha256Hash);\n} catch (ExplicitException e) {\n    if (e.getMessage().startsWith(\"Blob not found\")) {\n        // re-publish package or fetch from upstream\n    }\n    throw e;\n}","preventionTips":["Validate hashes before requests; keep blob references with the manifests that use them","Don't purge blobs still referenced by live manifests","Confirm correct projectId/server when reusing blob hashes across environments"],"tags":["not-found","package-registry","storage"],"backgroundTag":"resource-not-found","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}