{"record":{"id":"8a60fb6d98b5d941","repo":"theonedev/onedev","slug":"rulename-fixedbetween-should-be-used-for-sam","errorCode":null,"errorMessage":"'${ruleName(FixedBetween)}' should be used for same projects","messagePattern":"'(.+?)' should be used for same projects","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/search/entity/issue/FixedBetweenCriteria.java","lineNumber":64,"sourceCode":"\t\n\tpublic FixedBetweenCriteria(@Nullable Project project, int firstType, String firstValue, \n\t\t\tint secondType, String secondValue) {\n\t\tthis.project = project;\n\t\tthis.firstType = firstType;\n\t\tthis.firstValue = firstValue;\n\t\tthis.secondType = secondType;\n\t\tthis.secondValue = secondValue;\n\t}\n\t\n\tprivate ProjectAndCommitIds getProjectAndCommitIds() {\n\t\tif (projectAndCommitIds == null) {\n\t\t\tProjectScopedCommit first = getCommitId(project, firstType, firstValue);\n\t\t\tProjectScopedCommit second = getCommitId(project, secondType, secondValue);\n\t\t\tif (first.getProject().equals(second.getProject())) { \n\t\t\t\tprojectAndCommitIds = new ProjectAndCommitIds(\n\t\t\t\t\t\tfirst.getProject(), first.getCommitId(), second.getCommitId());\n\t\t\t} else {\n\t\t\t\tthrow new ExplicitException(\"'\" + getRuleName(IssueQueryLexer.FixedBetween) \n\t\t\t\t\t+ \"' should be used for same projects\");\n\t\t\t}\n\t\t}\n\t\treturn projectAndCommitIds;\n\t}\n\t\n\tprivate static ProjectScopedCommit getCommitId(@Nullable Project project, int type, String value) {\n\t\tif (type == IssueQueryLexer.Build) {\n\t\t\tBuild build = QueryUtils.getBuild(project, value);\n\t\t\treturn new ProjectScopedCommit(build.getProject(), build.getCommitId());\n\t\t} else {\n\t\t\treturn QueryUtils.getCommitId(project, value);\n\t\t}\n\t}\n\t\n\tprivate GitService getGitService() {\n\t\treturn OneDev.getInstance(GitService.class);\n\t}","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/search/entity/issue/FixedBetweenCriteria.java#L46-L82","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure both boundary commits resolve to the same project — use fully qualified values from the same project","Rewrite the query as two separate same-project fixed-between criteria and merge results manually","If comparing across projects, use a different operator (e.g. fixed in build/commit per project)","Validate both commit references' project before saving the shared query"],"exampleFix":"// before\n\"fixed between (\\\"main-project\\\" \\\"abc123\\\") (\\\"other-project\\\" \\\"def456\\\")\" // throws\n// after\n\"fixed between (\\\"main-project\\\" \\\"abc123\\\") (\\\"main-project\\\" \\\"def456\\\")\"","handlingStrategy":"validation","validationCode":"// resolve both references first and compare projects\nProject p1 = getCommitId(project, firstType, firstValue).getProject();\nProject p2 = getCommitId(project, secondType, secondValue).getProject();\nif (!p1.equals(p2)) throw new IllegalArgumentException(\"fixed between requires same-project commits\");","typeGuard":"boolean sameProject(ProjectScopedCommit a, ProjectScopedCommit b) { return a.getProject().equals(b.getProject()); }","tryCatchPattern":"try { issues = issueManager.query(project, query); } catch (ExplicitException e) { if (e.getMessage().contains(\"same projects\")) { fixQueryToSameProject(); } else { throw e; } }","preventionTips":["Qualify both boundary commits with the same project name","Avoid referencing branches/commits from other repositories in fixed-between","Validate both sides resolve to one project before saving shared queries","Split cross-project comparisons into per-project queries"],"tags":["onedev","issue-query","commit-range"],"backgroundTag":"invalid-argument-value","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"}