theonedev/onedev · error · ExplicitException
Revision not found:
Error message
Revision not found:
What it means
During markdown/blob rendering, URL processing resolves the blob's revision via GitService.resolve. If the revision string cannot be resolved to a commit (unknown branch/tag/SHA), an ExplicitException 'Revision not found: <revision>' is thrown.
Source
Thrown at server-core/src/main/java/io/onedev/server/markdown/UrlProcessor.java:50
import io.onedev.server.web.page.project.blob.render.BlobRenderContext;
import io.onedev.server.web.page.project.blob.render.BlobRenderContext.Mode;
public class UrlProcessor implements HtmlProcessor {
private static final Logger logger = LoggerFactory.getLogger(UrlProcessor.class);
@Override
public void process(Document document, Project project,
@Nullable BlobRenderContext blobRenderContext,
@Nullable SuggestionSupport suggestionSupport,
boolean forExternal) {
if (RequestCycle.get() != null && blobRenderContext != null && project != null) {
GitService gitService = OneDev.getInstance(GitService.class);
ObjectId revId;
if (blobRenderContext.getBlobIdent().revision != null) {
revId = gitService.resolve(project, blobRenderContext.getBlobIdent().revision, true);
if (revId == null)
throw new ExplicitException("Revision not found: " + blobRenderContext.getBlobIdent().revision);
} else {
revId = null;
}
NodeTraversor.traverse(new NodeVisitor() {
@Override
public void head(Node node, int depth) {
}
@Override
public void tail(Node node, int depth) {
try {
if (node.nodeName().equals("a")) {
String url = node.attr("href");
if (StringUtils.isNotBlank(url)) {
url = url.trim();
if (UrlUtils.isRelative(url) && !url.startsWith("#")) {View on GitHub (pinned to d44925c47c)
Solutions
- Use a revision that exists in the project: current branch, valid tag, or full commit SHA
- Update stale markdown links after branch deletion or history rewrites
- Verify revision spelling with git rev-parse in the repository
- Render against the default branch when the referenced revision is uncertain
Example fix
// before  (blob context revision: feature/old-branch, deleted) // after switch blob render context revision to 'main' or an existing commit SHA
Defensive patterns
Strategy: try-catch
Validate before calling
ObjectId revId = gitService.resolve(project, revision, true); if (revId == null) { /* revision missing */ } Try / catch
try { renderBlob(ctx); } catch (ExplicitException e) { showFriendlyRevisionError(e.getMessage()); } Prevention
- Reference existing branches/tags or immutable full SHAs in links
- Update markdown after deleting branches/rewriting history
- Prefer default branch in long-lived docs links
When it happens
Trigger: Rendering a blob/attachment URL whose blobIdent.revision names a branch, tag, or commit hash that does not exist in the project repository (e.g. deleted branch, typo'd tag, commit from a fork).
Common situations: Markdown files linking to images on a branch that was later deleted; comparing docs across forks; typos in revision embedded in relative links; force-push rewriting history referenced by old links.
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
- Unable to find commit to import build spec (import project:
- Unable to find blob path '<path>' in revision '<revision>'
- Unable to find revision ''
- Unable to find revision: ${value}
- Ref name is required when commit hash is specified
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/9a389c97d674d3ee.
Report an issue: GitHub.