theonedev/onedev · error · NotAcceptableException
State is required
Error message
State is required
What it means
Guard in the change-issue-state endpoint of TodResource: the submitted state-change data contained no state field, so there is no target state to move the issue to. The caller (an AI agent) must supply the desired state name.
Source
Thrown at server-core/src/main/java/io/onedev/server/ai/TodResource.java:674
@Path("/change-issue-state")
@POST
public Map<String, Object> changeIssueState(
@QueryParam("currentProject") @NotNull String currentProjectPath,
@QueryParam("reference") @NotNull String issueReference,
@NotNull Map<String, Serializable> data) {
var subject = SecurityUtils.getSubject();
var user = SecurityUtils.getUser(subject);
if (user == null)
throw new UnauthenticatedException();
var currentProject = getProject(currentProjectPath);
var issue = getIssue(currentProject, issueReference);
IssueHelper.normalizeData(data);
var state = (String) data.remove("state");
if (state == null)
throw new NotAcceptableException("State is required");
var comment = (String) data.remove("comment");
ManualSpec transition = issue.getProject().getManualSpec(subject, issue, state);
if (transition == null) {
var message = MessageFormat.format(
"No applicable manual transition spec found for current user (issue: {0}, from state: {1}, to state: {2})",
issue.getReference().toString(), issue.getState(), state);
throw new NotAcceptableException(message);
}
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(View on GitHub (pinned to d44925c47c)
Solutions
- Include a non-empty 'state' key in the request data matching a state defined in the project's issue workflow.
- Fix the key spelling to lowercase 'state'.
- Validate the payload before sending.
Example fix
// before
Map<String, Serializable> data = Map.of("comment", "done");
// after
Map<String, Serializable> data = Map.of("state", "Done", "comment", "done"); Defensive patterns
Strategy: validation
Validate before calling
if (!data || typeof data.state !== "string" || data.state.trim() === "") {
throw new Error("'state' is required to transition an issue");
} Type guard
function hasState(d) {
return typeof d === "object" && d !== null && typeof d.state === "string" && d.state.length > 0;
} Prevention
- Always include 'state' in transition payloads.
- Normalize key casing before sending (lowercase 'state').
- Validate payloads against the endpoint's expected schema in tests.
When it happens
Trigger: Calling the AI tod state-change endpoint with a data map lacking the 'state' key, or with state normalized to null (e.g., empty value removed by IssueHelper.normalizeData).
Common situations: Client sends only a comment or field values expecting the transition to be inferred; typo in key name ('Status' instead of 'state'); payload built programmatically without the state entry.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- No applicable manual transition spec found for current user
- Issue ${issueReference} is not in current project
- Pull request submitter cannot be reviewer
- Job name is required
- Error validating issue fields:
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/3424228d5ba80112.
Report an issue: GitHub.