theonedev/onedev · error · ExplicitException

'${ruleName(FixedBetween)}' should be used for same projects

Error message

'${ruleName(FixedBetween)}' should be used for same projects

What it means

The FixedBetween criteria ('fixed between' operator) resolves both boundary commits and requires them to belong to the same project, since the commit range is project-scoped. When the first and second resolved commits come from different projects, an ExplicitException is thrown telling the user the operator only supports same-project ranges.

Source

Thrown at server-core/src/main/java/io/onedev/server/search/entity/issue/FixedBetweenCriteria.java:64

	
	public FixedBetweenCriteria(@Nullable Project project, int firstType, String firstValue, 
			int secondType, String secondValue) {
		this.project = project;
		this.firstType = firstType;
		this.firstValue = firstValue;
		this.secondType = secondType;
		this.secondValue = secondValue;
	}
	
	private ProjectAndCommitIds getProjectAndCommitIds() {
		if (projectAndCommitIds == null) {
			ProjectScopedCommit first = getCommitId(project, firstType, firstValue);
			ProjectScopedCommit second = getCommitId(project, secondType, secondValue);
			if (first.getProject().equals(second.getProject())) { 
				projectAndCommitIds = new ProjectAndCommitIds(
						first.getProject(), first.getCommitId(), second.getCommitId());
			} else {
				throw new ExplicitException("'" + getRuleName(IssueQueryLexer.FixedBetween) 
					+ "' should be used for same projects");
			}
		}
		return projectAndCommitIds;
	}
	
	private static ProjectScopedCommit getCommitId(@Nullable Project project, int type, String value) {
		if (type == IssueQueryLexer.Build) {
			Build build = QueryUtils.getBuild(project, value);
			return new ProjectScopedCommit(build.getProject(), build.getCommitId());
		} else {
			return QueryUtils.getCommitId(project, value);
		}
	}
	
	private GitService getGitService() {
		return OneDev.getInstance(GitService.class);
	}

View on GitHub (pinned to d44925c47c)

Solutions

  1. Ensure both boundary commits resolve to the same project — use fully qualified values from the same project
  2. Rewrite the query as two separate same-project fixed-between criteria and merge results manually
  3. If comparing across projects, use a different operator (e.g. fixed in build/commit per project)
  4. Validate both commit references' project before saving the shared query

Example fix

// before
"fixed between (\"main-project\" \"abc123\") (\"other-project\" \"def456\")" // throws
// after
"fixed between (\"main-project\" \"abc123\") (\"main-project\" \"def456\")"
Defensive patterns

Strategy: validation

Validate before calling

// resolve both references first and compare projects
Project p1 = getCommitId(project, firstType, firstValue).getProject();
Project p2 = getCommitId(project, secondType, secondValue).getProject();
if (!p1.equals(p2)) throw new IllegalArgumentException("fixed between requires same-project commits");

Type guard

boolean sameProject(ProjectScopedCommit a, ProjectScopedCommit b) { return a.getProject().equals(b.getProject()); }

Try / catch

try { issues = issueManager.query(project, query); } catch (ExplicitException e) { if (e.getMessage().contains("same projects")) { fixQueryToSameProject(); } else { throw e; } }

Prevention

When it happens

Trigger: Writing an issue query like 'fixed between (projectA commitX) (projectB commitY)' or referencing two commits (branches/tags) that resolve to different projects — e.g. comparing a commit in a forked/sub-project with one in the main project.

Common situations: Copy-pasting a fixed-between query across projects; referencing a branch of another repository; monorepo/fork setups where boundary values resolve to different ProjectScopedCommit projects.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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