{"record":{"id":"9a389c97d674d3ee","repo":"theonedev/onedev","slug":"revision-not-found","errorCode":null,"errorMessage":"Revision not found: ","messagePattern":"Revision not found: ","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/markdown/UrlProcessor.java","lineNumber":50,"sourceCode":"import io.onedev.server.web.page.project.blob.render.BlobRenderContext;\nimport io.onedev.server.web.page.project.blob.render.BlobRenderContext.Mode;\n\npublic class UrlProcessor implements HtmlProcessor {\n\n\tprivate static final Logger logger = LoggerFactory.getLogger(UrlProcessor.class);\n\t\n\t@Override\n\tpublic void process(Document document, Project project,\n\t\t\t\t\t\t@Nullable BlobRenderContext blobRenderContext,\n\t\t\t\t\t\t@Nullable SuggestionSupport suggestionSupport,\n\t\t\t\t\t\tboolean forExternal) {\n\t\tif (RequestCycle.get() != null && blobRenderContext != null && project != null) {\n\t\t\tGitService gitService = OneDev.getInstance(GitService.class);\n\t\t\tObjectId revId;\n\t\t\tif (blobRenderContext.getBlobIdent().revision != null) {\n\t\t\t\trevId = gitService.resolve(project, blobRenderContext.getBlobIdent().revision, true);\n\t\t\t\tif (revId == null)\n\t\t\t\t\tthrow new ExplicitException(\"Revision not found: \" + blobRenderContext.getBlobIdent().revision);\n\t\t\t} else {\n\t\t\t\trevId = null;\n\t\t\t}\n\t\t\t\n\t\t\tNodeTraversor.traverse(new NodeVisitor() {\n\n\t\t\t\t@Override\n\t\t\t\tpublic void head(Node node, int depth) {\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void tail(Node node, int depth) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (node.nodeName().equals(\"a\")) {\n\t\t\t\t\t\t\tString url = node.attr(\"href\");\n\t\t\t\t\t\t\tif (StringUtils.isNotBlank(url)) {\n\t\t\t\t\t\t\t\turl = url.trim();\n\t\t\t\t\t\t\t\tif (UrlUtils.isRelative(url) && !url.startsWith(\"#\")) {","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/markdown/UrlProcessor.java#L32-L68","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before\n![img](img/logo.png)  (blob context revision: feature/old-branch, deleted)\n// after\nswitch blob render context revision to 'main' or an existing commit SHA","handlingStrategy":"try-catch","validationCode":"ObjectId revId = gitService.resolve(project, revision, true); if (revId == null) { /* revision missing */ }","typeGuard":null,"tryCatchPattern":"try { renderBlob(ctx); } catch (ExplicitException e) { showFriendlyRevisionError(e.getMessage()); }","preventionTips":["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"],"tags":["git","markdown","revision"],"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"}