theonedev/onedev · error · NotFoundException

Unable to find revision: ${value}

Error message

Unable to find revision: ${value}

What it means

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.

Source

Thrown at server-core/src/main/java/io/onedev/server/util/QueryUtils.java:132

		else
			throw new NotAcceptableException("Invalid boolean: " + value);
	}
	
	public static Date getDateValue(String value) {
		Date dateValue = DateUtils.parseRelaxed(value);
		if (dateValue == null)
			throw new NotAcceptableException("Unrecognized date: " + value);
		return dateValue;
	}

	public static ProjectScopedCommit getCommitId(@Nullable Project project, String value) {
		if (project != null && !value.contains(":"))
			value = project.getPath() + ":" + value;
		ProjectScopedCommit commitId = ProjectScopedCommit.from(value);
		if (commitId != null && commitId.getCommitId() != null)
			return commitId;
		else
			throw new NotFoundException("Unable to find revision: " + value);
	}

	public static ProjectScopedRevision getRevision(@Nullable Project project, String value) {
		if (project != null && !value.contains(":"))
			value = project.getPath() + ":" + value;
		ProjectScopedRevision revision = ProjectScopedRevision.from(value);
		if (revision != null)
			return revision;
		else
			throw new NotFoundException("Unable to find revision: " + value);
	}
	
	public static Issue getIssue(@Nullable Project project, String value) {
		var reference = IssueReference.of(value, project);
		var issueService = OneDev.getInstance(IssueService.class);
		var issue = issueService.find(reference.getProject(), reference.getNumber());
		if (issue != null)
			return issue.resolveMovedTo();

View on GitHub (pinned to d44925c47c)

Solutions

  1. Verify the revision (hash, branch, or tag) exists in the specified project with git log / the OneDev UI
  2. Include the project prefix in the value (e.g. 'group/project:my-branch') or pass the correct default Project argument
  3. Use the full commit hash rather than a short abbreviation to avoid ambiguity
  4. If the branch/tag was deleted, update the query to reference an existing revision

Example fix

// before
ProjectScopedCommit c = QueryUtils.getCommitId(null, "abc1234");
// after
ProjectScopedCommit c = QueryUtils.getCommitId(project, "group/my-project:5f3a9c1d2e...full-hash");
Defensive patterns

Strategy: validation

Validate before calling

if (!value.contains(":") && project == null)
    throw new UserException("Revision must be qualified as 'project:revision' when no default project is set");
// optionally verify the commit exists:
// project.getCommitId(revision) != null

Type guard

boolean revisionResolvable(String scopedValue) {
    return ProjectScopedCommit.from(scopedValue) != null
        && ProjectScopedCommit.from(scopedValue).getCommitId() != null;
}

Try / catch

try {
    ProjectScopedCommit c = QueryUtils.getCommitId(project, value);
} catch (NotFoundException e) {
    logger.warn("Unresolvable revision: {}", value);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

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/bf31ab651beed784. Report an issue: GitHub.