{"record":{"id":"aef40170d92a59ad","repo":"theonedev/onedev","slug":"not-found","errorCode":null,"errorMessage":"Not found","messagePattern":"Not found","errorType":"http","errorClass":"NotFoundException","httpStatus":404,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/ai/TodResource.java","lineNumber":1348,"sourceCode":"\n        if (!SecurityUtils.canModifyPullRequest(request))\n            throw new UnauthorizedException(\"No permission to edit pull request: \" + pullRequestReference);\n\n        normalizePullRequestData(data);\n\n        var title = (String) data.remove(\"title\");\n        if (title != null) \n            pullRequestChangeService.changeTitle(user, request, title);\n\n        if (data.containsKey(\"description\")) \n            pullRequestChangeService.changeDescription(user, request, (String) data.remove(\"description\"));\n\n        var labelNames = (List<String>) data.remove(\"labels\");\n        if (labelNames != null) {\n            try {\n                pullRequestLabelService.sync(request, labelNames);\n            } catch (EntityNotFoundException e) {\n                throw new NotFoundException(e.getMessage());\n            }\n        }\n\n        var mergeStrategyName = (String) data.remove(\"mergeStrategy\");\n        if (mergeStrategyName != null) {\n            if (!request.isOpen())\n                throw new NotAcceptableException(\"Pull request is closed\");\n            pullRequestChangeService.changeMergeStrategy(user, request, MergeStrategy.valueOf(mergeStrategyName));\n        }\n\n        var assigneeNames = (List<String>) data.remove(\"assignees\");\n        if (assigneeNames != null) {                        \n            if (!request.isOpen())\n                throw new NotAcceptableException(\"Pull request is closed\");\n            for (var assigneeName : assigneeNames) {\n                User assignee = userService.findByName(assigneeName);\n                if (assignee == null)\n                    throw new NotFoundException(\"Assignee not found: \" + assigneeName);","sourceCodeStart":1330,"sourceCodeEnd":1366,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/ai/TodResource.java#L1330-L1366","documentation":"Thrown by the /edit-pull-request endpoint when syncing the 'labels' field fails because one of the supplied label names does not exist in the project. The underlying pullRequestLabelService.sync() throws EntityNotFoundException, which is re-wrapped as a NotFoundException with the original message (typically naming the missing label).","triggerScenarios":"POST /edit-pull-request with a 'labels' array containing a label name that does not exist on the target project (or is referenced from a different project than the one holding the label definitions).","commonSituations":"Typos or case mismatches in label names; labels defined in another project than currentProject; labels deleted after an AI/automation script captured an old label list; tooling that copies labels across projects without creating them first.","solutions":["Check the error message for the missing label name and create that label in the project (Project -> Pull Requests -> Labels) before retrying.","Verify label spelling and exact case against the project's existing label list.","Ensure you are passing labels that belong to the same project as currentProject, not another project's labels.","Remove the unknown label from the 'labels' array or call the label-creation API first."],"exampleFix":"// before\n{\"labels\": [\"bug\", \"priorty-high\"]}\n// after\n{\"labels\": [\"bug\", \"priority-high\"]}  // corrected to an existing label name","handlingStrategy":"validation","validationCode":"const projectLabels = await getProjectLabels(currentProject);\nconst invalid = labels.filter(l => !projectLabels.some(p => p.name === l));\nif (invalid.length) throw new Error(`Labels not found in project: ${invalid.join(', ')}`);","typeGuard":null,"tryCatchPattern":"try {\n  await editPullRequest(ref, { labels });\n} catch (e) {\n  if (e.status === 404 && /label/i.test(e.message)) {\n    // sync label list from project and retry with valid names\n  }\n}","preventionTips":["Fetch the project's label list before syncing and intersect with it.","Treat label names as case-sensitive exact matches.","Create missing labels programmatically before referencing them.","Avoid caching label lists for long-running automations."],"tags":["rest","labels","not-found","onedev"],"backgroundTag":"resource-not-found","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"}