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

  1. Use a revision that exists in the project: current branch, valid tag, or full commit SHA
  2. Update stale markdown links after branch deletion or history rewrites
  3. Verify revision spelling with git rev-parse in the repository
  4. Render against the default branch when the referenced revision is uncertain

Example fix

// before
![img](img/logo.png)  (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

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


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/9a389c97d674d3ee. Report an issue: GitHub.