theonedev/onedev · error · NotAcceptableException

${e.getMessage()}

Error message

${e.getMessage()}

What it means

When IssueHelper.createIssue throws an ExplicitException (e.g. validation failures inside issue creation such as missing fields, bad project, or business rules), TodResource.createIssue rethrows it as a NotAcceptableException whose message is the original exception text (this is why the message appears as ${e.getMessage()}). The developer should look at the actual message returned to know which creation input was rejected.

Source

Thrown at server-core/src/main/java/io/onedev/server/ai/TodResource.java:577

    }

    @Path("/create-issue")
    @POST
    public Map<String, Object> createIssue(
                @QueryParam("currentProject") @NotNull String currentProjectPath, 
                @QueryParam("project") String projectPath, 
                @NotNull @Valid Map<String, Serializable> data) {
        var subject = SecurityUtils.getSubject();
        if (SecurityUtils.getUser(subject) == null)
            throw new UnauthenticatedException();

        var projectContext = getProjectContext(projectPath, currentProjectPath);

        Issue issue;
        try {
            issue = IssueHelper.createIssue(subject, projectContext.project, data);
        } catch (ExplicitException e) {
            throw new NotAcceptableException(e.getMessage());
        }

        return IssueHelper.getDetail(projectContext.currentProject, issue);
    }

    @Path("/edit-issue")
    @POST
    public Map<String, Object> editIssue(
                @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);

View on GitHub (pinned to d44925c47c)

Solutions

  1. Read the actual message in the HTTP 406 response; it names the concrete problem from ExplicitException.
  2. Validate the data map before sending: ensure required keys (e.g. title) are present and values match the project's issue field definitions.
  3. Check the target project's issue settings (custom fields, required fields) and align the payload.
  4. Confirm the authenticated user has permission to create issues in the resolved project.

Example fix

// before
createIssue(project, {titel: "Bug"}) // typo'd key -> ExplicitException
// after
createIssue(project, {title: "Bug", description: "Something broke"})
Defensive patterns

Strategy: try-catch

Validate before calling

const required = ['title'];
for (const k of required) if (!data[k] || !String(data[k]).trim()) throw new Error(`create-issue: missing field '${k}'`);
// align keys with project issue field settings before sending

Try / catch

try { return createIssue(project, data); } catch (e) { if (e.status === 406) { console.error('Issue creation rejected:', e.message); return null; } throw e; }

Prevention

When it happens

Trigger: POST /create-issue with a data map that fails IssueHelper.createIssue validation: missing title/description, unknown field names, invalid state/field values, or referencing a project where the user cannot create issues.

Common situations: AI tooling sending a schema that doesn't match OneDev's expected issue data keys; submitting empty title; field values violating custom issue field constraints.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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