theonedev/onedev · error · ExplicitException
Blob not found: %s
Error message
Blob not found: %s
What it means
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.
Source
Thrown at server-core/src/main/java/io/onedev/server/service/impl/DefaultPackBlobService.java:456
return new Pair<>(packBlob.getId(), false);
} else {
return new Pair<>(packBlob.getId(), true);
}
});
}
@Override
public byte[] readBlob(Long projectId, String sha256Hash) {
var packBlob = findBySha256Hash(projectId, sha256Hash);
if (packBlob != null) {
var baos = new ByteArrayOutputStream();
downloadBlob(projectId, sha256Hash, baos);
var bytes = baos.toByteArray();
if (bytes.length != packBlob.getSize())
throw new ExplicitException("Invalid blob size: " + sha256Hash);
return bytes;
} else {
throw new ExplicitException("Blob not found: " + sha256Hash);
}
}
@Override
public void downloadBlob(Long projectId, String sha256Hash, OutputStream os) {
var activeServer = projectService.getActiveServer(projectId, true);
if (activeServer.equals(clusterService.getLocalServerAddress())) {
read(getFileLockName(projectId, sha256Hash), () -> {
try (var is = new FileInputStream(getPackBlobFile(projectId, sha256Hash))) {
copy(is, os, BUFFER_SIZE);
}
return null;
});
} else {
Client client = ClientBuilder.newClient();
try {
String serverUrl = clusterService.getServerUrl(activeServer);
WebTarget target = client.target(serverUrl).path("~api/cluster/pack-blob")View on GitHub (pinned to d44925c47c)
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
Example fix
// before: unconditional read
byte[] data = packBlobService.readBlob(projectId, sha256Hash);
// after: check existence first
if (packBlobService.findBlob(projectId, sha256Hash) == null) {
throw new ExplicitException("Blob " + sha256Hash + " not published to project " + projectId);
}
byte[] data = packBlobService.readBlob(projectId, sha256Hash); Defensive patterns
Strategy: try-catch
Validate before calling
var blob = packBlobService.findBySha256Hash(projectId, sha256Hash);
if (blob == null) {
throw new ExplicitException("Blob " + sha256Hash + " does not exist in project " + projectId);
} Type guard
function blobExists(packBlobService, projectId, sha256Hash) {
return packBlobService.findBySha256Hash(projectId, sha256Hash) != null;
} Try / catch
try {
return packBlobService.readBlob(projectId, sha256Hash);
} catch (ExplicitException e) {
if (e.getMessage().startsWith("Blob not found")) {
// re-publish package or fetch from upstream
}
throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Invalid blob size: %s
- User not found: ${userName}
- Issue not found: ${referenceString}
- Iteration '${iterationName}' not found
- Link spec not found: ${linkName}
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/82bad269dd1b80a2.
Report an issue: GitHub.