{"record":{"id":"bf31ab651beed784","repo":"theonedev/onedev","slug":"unable-to-find-revision-value","errorCode":null,"errorMessage":"Unable to find revision: ${value}","messagePattern":"Unable to find revision: (.+?)","errorType":"exception","errorClass":"NotFoundException","httpStatus":404,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/util/QueryUtils.java","lineNumber":132,"sourceCode":"\t\telse\n\t\t\tthrow new NotAcceptableException(\"Invalid boolean: \" + value);\n\t}\n\t\n\tpublic static Date getDateValue(String value) {\n\t\tDate dateValue = DateUtils.parseRelaxed(value);\n\t\tif (dateValue == null)\n\t\t\tthrow new NotAcceptableException(\"Unrecognized date: \" + value);\n\t\treturn dateValue;\n\t}\n\n\tpublic static ProjectScopedCommit getCommitId(@Nullable Project project, String value) {\n\t\tif (project != null && !value.contains(\":\"))\n\t\t\tvalue = project.getPath() + \":\" + value;\n\t\tProjectScopedCommit commitId = ProjectScopedCommit.from(value);\n\t\tif (commitId != null && commitId.getCommitId() != null)\n\t\t\treturn commitId;\n\t\telse\n\t\t\tthrow new NotFoundException(\"Unable to find revision: \" + value);\n\t}\n\n\tpublic static ProjectScopedRevision getRevision(@Nullable Project project, String value) {\n\t\tif (project != null && !value.contains(\":\"))\n\t\t\tvalue = project.getPath() + \":\" + value;\n\t\tProjectScopedRevision revision = ProjectScopedRevision.from(value);\n\t\tif (revision != null)\n\t\t\treturn revision;\n\t\telse\n\t\t\tthrow new NotFoundException(\"Unable to find revision: \" + value);\n\t}\n\t\n\tpublic static Issue getIssue(@Nullable Project project, String value) {\n\t\tvar reference = IssueReference.of(value, project);\n\t\tvar issueService = OneDev.getInstance(IssueService.class);\n\t\tvar issue = issueService.find(reference.getProject(), reference.getNumber());\n\t\tif (issue != null)\n\t\t\treturn issue.resolveMovedTo();","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/util/QueryUtils.java#L114-L150","documentation":"QueryUtils.getCommitId converts a revision string (optionally 'project:revision') into a ProjectScopedCommit and verifies the commit actually resolves. If ProjectScopedCommit.from returns null or the commitId is null — meaning the revision cannot be resolved in the referenced project — a NotFoundException 'Unable to find revision' is thrown.","triggerScenarios":"Calling QueryUtils.getCommitId with a commit hash, branch, or tag that does not exist in the target project; omitting the project prefix when no default project is passed; using a revision from a different repository than the one referenced.","commonSituations":"Query criteria referencing a commit hash that was later garbage-collected or belongs to a fork; branch deleted after the query was saved; forgotten 'project:' prefix so the value is looked up in the wrong repo; shorthand abbreviations of hashes that are ambiguous or too short.","solutions":["Verify the revision (hash, branch, or tag) exists in the specified project with git log / the OneDev UI","Include the project prefix in the value (e.g. 'group/project:my-branch') or pass the correct default Project argument","Use the full commit hash rather than a short abbreviation to avoid ambiguity","If the branch/tag was deleted, update the query to reference an existing revision"],"exampleFix":"// before\nProjectScopedCommit c = QueryUtils.getCommitId(null, \"abc1234\");\n// after\nProjectScopedCommit c = QueryUtils.getCommitId(project, \"group/my-project:5f3a9c1d2e...full-hash\");","handlingStrategy":"validation","validationCode":"if (!value.contains(\":\") && project == null)\n    throw new UserException(\"Revision must be qualified as 'project:revision' when no default project is set\");\n// optionally verify the commit exists:\n// project.getCommitId(revision) != null","typeGuard":"boolean revisionResolvable(String scopedValue) {\n    return ProjectScopedCommit.from(scopedValue) != null\n        && ProjectScopedCommit.from(scopedValue).getCommitId() != null;\n}","tryCatchPattern":"try {\n    ProjectScopedCommit c = QueryUtils.getCommitId(project, value);\n} catch (NotFoundException e) {\n    logger.warn(\"Unresolvable revision: {}\", value);\n}","preventionTips":["Always scope revisions with the project prefix in cross-project queries","Use full commit hashes instead of short abbreviations","Refresh queries after deleting branches or force-pushing rewritten history"],"tags":["git","revision","commit","not-found","onedev"],"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"}