{"record":{"id":"ceb323ef353cb0b5","repo":"theonedev/onedev","slug":"e-getmessage","errorCode":null,"errorMessage":"${e.getMessage()}","messagePattern":"\\$\\{e\\.getMessage\\(\\)\\}","errorType":"http","errorClass":"NotAcceptableException","httpStatus":406,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/ai/TodResource.java","lineNumber":577,"sourceCode":"    }\n\n    @Path(\"/create-issue\")\n    @POST\n    public Map<String, Object> createIssue(\n                @QueryParam(\"currentProject\") @NotNull String currentProjectPath, \n                @QueryParam(\"project\") String projectPath, \n                @NotNull @Valid Map<String, Serializable> data) {\n        var subject = SecurityUtils.getSubject();\n        if (SecurityUtils.getUser(subject) == null)\n            throw new UnauthenticatedException();\n\n        var projectContext = getProjectContext(projectPath, currentProjectPath);\n\n        Issue issue;\n        try {\n            issue = IssueHelper.createIssue(subject, projectContext.project, data);\n        } catch (ExplicitException e) {\n            throw new NotAcceptableException(e.getMessage());\n        }\n\n        return IssueHelper.getDetail(projectContext.currentProject, issue);\n    }\n\n    @Path(\"/edit-issue\")\n    @POST\n    public Map<String, Object> editIssue(\n                @QueryParam(\"currentProject\") @NotNull String currentProjectPath, \n                @QueryParam(\"reference\") @NotNull String issueReference, \n                @NotNull Map<String, Serializable> data) {\n        var subject = SecurityUtils.getSubject();\n        var user = SecurityUtils.getUser(subject);\n\n        if (user == null)\n            throw new UnauthenticatedException();\n\n        var currentProject = getProject(currentProjectPath);","sourceCodeStart":559,"sourceCodeEnd":595,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/ai/TodResource.java#L559-L595","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the actual message in the HTTP 406 response; it names the concrete problem from ExplicitException.","Validate the data map before sending: ensure required keys (e.g. title) are present and values match the project's issue field definitions.","Check the target project's issue settings (custom fields, required fields) and align the payload.","Confirm the authenticated user has permission to create issues in the resolved project."],"exampleFix":"// before\ncreateIssue(project, {titel: \"Bug\"}) // typo'd key -> ExplicitException\n// after\ncreateIssue(project, {title: \"Bug\", description: \"Something broke\"})","handlingStrategy":"try-catch","validationCode":"const required = ['title'];\nfor (const k of required) if (!data[k] || !String(data[k]).trim()) throw new Error(`create-issue: missing field '${k}'`);\n// align keys with project issue field settings before sending","typeGuard":null,"tryCatchPattern":"try { return createIssue(project, data); } catch (e) { if (e.status === 406) { console.error('Issue creation rejected:', e.message); return null; } throw e; }","preventionTips":["Match payload keys exactly to OneDev's issue data schema (title, description, ...)","Respect the project's custom field definitions and required fields","Surface the server's 406 message to users instead of retrying blindly","Sanitize and trim user-provided titles/descriptions before sending"],"tags":["validation","rest-api","http-406","issue-creation"],"backgroundTag":"schema-validation-failed","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}