theonedev/onedev · error · NotAcceptableException
Issue ${issueReference} is not in current project
Error message
Issue ${issueReference} is not in current project What it means
Thrown as NotAcceptableException when creating an issue branch: the resolved issue belongs to a different project than the currentProject parameter. OneDev requires the issue and the target project for the branch to match.
Source
Thrown at server-core/src/main/java/io/onedev/server/ai/TodResource.java:701
var fieldValues = FieldUtils.getFieldValues(subject, issue.getProject(), data);
issueChangeService.changeState(user, issue, state, fieldValues, transition.getPromptFields(),
transition.getRemoveFields(), comment);
return IssueHelper.getDetail(currentProject, issue);
}
@Path("/ensure-issue-branch")
@POST
public String ensureIssueBranch(
@QueryParam("currentProject") @NotNull String currentProjectPath,
@QueryParam("reference") @NotNull String issueReference) {
var subject = SecurityUtils.getSubject();
var currentProject = getProject(currentProjectPath);
var issue = getIssue(currentProject, issueReference);
if (!issue.getProject().equals(currentProject))
throw new NotAcceptableException("Issue " + issueReference + " is not in current project");
return issueService.ensureBranch(subject, issue);
}
@Path("/link-issues")
@GET
public Map<String, Object> linkIssues(
@QueryParam("currentProject") @NotNull String currentProjectPath,
@QueryParam("sourceReference") @NotNull String sourceReference,
@QueryParam("linkName") @Nullable String linkName,
@QueryParam("targetReference") @NotNull String targetReference) {
if (SecurityUtils.getUser() == null)
throw new UnauthenticatedException();
var currentProject = getProject(currentProjectPath);
var sourceIssue = getIssue(currentProject, sourceReference);
var targetIssue = getIssue(currentProject, targetReference);View on GitHub (pinned to d44925c47c)
Solutions
- Pass the currentProject matching the project the issue actually belongs to.
- Use the issue's full reference (e.g., project-1 #12) consistent with currentProject.
- Verify the issue's project via issue detail before calling ensure branch.
Example fix
// before GET ...?currentProject=app&reference=#12 // #12 belongs to 'lib' // after GET ...?currentProject=lib&reference=#12
Defensive patterns
Strategy: validation
Validate before calling
if (issue.project.name !== currentProject) {
throw new Error(`Issue belongs to ${issue.project.name}, not ${currentProject}`);
} Type guard
function issueInProject(issue, project) {
return issue.project?.name === project;
} Try / catch
try {
await ensureBranch(currentProject, ref);
} catch (e) {
if (e.status === 406 || /is not in current project/.test(e.message)) {
// re-resolve the issue's project and retry with the correct currentProject
} else throw e;
} Prevention
- Derive currentProject from the issue reference (project part) instead of hardcoding.
- Resolve full issue references like 'project #12' before calls.
- Avoid assuming issue numbers are unique across projects.
When it happens
Trigger: Calling the AI tod ensure-branch endpoint with currentProject=A and an issue reference that resolves to an issue in project B.
Common situations: Agent passes the wrong currentProject query parameter; issue reference copied from a different project's board; cross-project issue numbering confusion (issue numbers collide across 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
- Title is required
- Issue schedule permission required to set iterations
- Iteration '${iterationName}' not found
- State is required
- Pull request submitter cannot be reviewer
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/2654acda5353f90e.
Report an issue: GitHub.