{"record":{"id":"378888184c1df915","repo":"theonedev/onedev","slug":"code-problem-report-not-found","errorCode":null,"errorMessage":"Code problem report not found: ","messagePattern":"Code problem report not found: ","errorType":"http","errorClass":"NotFoundException","httpStatus":404,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/ai/TodResource.java","lineNumber":883,"sourceCode":"    @Path(\"/get-build-code-problems\")\n    @GET\n    public List<Map<String, Object>> getBuildCodeProblems(\n                @QueryParam(\"currentProject\") @NotNull String currentProjectPath, \n                @QueryParam(\"reference\") @NotNull String buildReference, \n                @QueryParam(\"reportName\") @NotNull String reportName, \n                @QueryParam(\"severityLevel\") @NotNull CodeProblem.Severity severityLevel) {\n        if (SecurityUtils.getUser() == null)\n            throw new UnauthenticatedException();\n\n        var currentProject = getProject(currentProjectPath);\n        var build = getBuild(currentProject, buildReference);\n\n        if (!SecurityUtils.canAccessReport(build, reportName))\n            throw new UnauthorizedException(\"No permission to access report: \" + reportName);\n\n        var report = ProblemReport.readFrom(build, reportName);\n        if (report == null)\n            throw new NotFoundException(\"Code problem report not found: \" + reportName);\n\n        var problems = new ArrayList<Map<String, Object>>();\n        for (var problem: report.getProblems()) {\n            if (problem.getSeverity().ordinal() <= severityLevel.ordinal()) {\n                var problemMap = new HashMap<String, Object>();\n                problemMap.put(\"severity\", problem.getSeverity().name());\n                problemMap.put(\"message\", problem.getMessage());\n                if (problem.getTarget() instanceof BlobTarget blobTarget) {\n                    problemMap.put(\"file\", blobTarget.getGroupKey().getName());\n                    if (blobTarget.getLocation() != null) {\n                        problemMap.put(\"beginLine\", blobTarget.getLocation().getFromRow() + 1);\n                        problemMap.put(\"endLine\", blobTarget.getLocation().getToRow() + 1);\n                    }\n                } else if (problem.getTarget() instanceof ContainerTarget containerTarget) {\n                    problemMap.put(\"target\", containerTarget.getGroupKey().getName());\n                    problemMap.put(\"platform\", ((ContainerTarget.GroupKey) containerTarget.getGroupKey()).getPlatform());\n                } else if (problem.getTarget() instanceof GeneralTarget generalTarget) {\n                    problemMap.put(\"target\", generalTarget.getGroupKey().getName());","sourceCodeStart":865,"sourceCodeEnd":901,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/ai/TodResource.java#L865-L901","documentation":"GET /get-build-code-problems throws NotFoundException ('Code problem report not found: {name}') when ProblemReport.readFrom(build, reportName) returns null - no problem report with that name exists on the specified build. Access checks pass; the report itself is simply absent.","triggerScenarios":"Calling get-build-code-problems with a reportName that was never published on the build (typo, different job published it, build has no problems report), or the report only exists on newer/other builds.","commonSituations":"Renamed report in CI job spec; build finished before the publish-report step ran; querying an old build from before the report was introduced; case mismatch in report name.","solutions":["Check the exact report name in the CI job's publishReport spec and use that name in the reportName param","List available reports via GET /api/builds/{id}/reports to find valid names","Re-run the build so the publish-report step produces the report","Point the reference param at a build that actually published the code problem report"],"exampleFix":"// before\nGET /~api/tod/get-build-code-problems?currentProject=app&reference=42&reportName=problem\n// after\nGET /~api/tod/get-build-code-problems?currentProject=app&reference=42&reportName=code-problems  # exact published report name","handlingStrategy":"validation","validationCode":"const reports = await listBuildReports(buildId); if (!reports.some(r => r.name === reportName)) throw new Error(`No report '${reportName}' on build ${buildId}; available: ${reports.map(r=>r.name).join(',')}`);","typeGuard":"function hasReport(reports, name) { return Array.isArray(reports) && reports.some(r => r?.name === name); }","tryCatchPattern":"try { await getBuildCodeProblems(params); } catch (e) { if (e.status === 404 || /report not found/i.test(e.message)) { const avail = await listBuildReports(buildId); throw new Error('Unknown report; available: ' + avail.map(r=>r.name).join(',')); } throw e; }","preventionTips":["List build reports before fetching a specific one","Use the exact report name from the CI job's publishReport spec (case-sensitive)","Confirm the build actually ran the publish-report step","Handle builds from before the report existed"],"tags":["reports","builds","not-found"],"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"}