{"record":{"id":"837bc0fff4e0f9c5","repo":"theonedev/onedev","slug":"unknown-problem-target-type","errorCode":null,"errorMessage":"Unknown problem target type: ","messagePattern":"Unknown problem target type: ","errorType":"http","errorClass":"ExplicitException","httpStatus":400,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/ai/TodResource.java","lineNumber":903,"sourceCode":"        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());\n                } else {\n                    throw new ExplicitException(\"Unknown problem target type: \" + problem.getTarget().getClass().getName());\n                }\n                problems.add(problemMap);\n            }\n        }\n        return problems;\n    }\n\n    @Path(\"/get-build-unit-test-report\")\n    @GET\n    public Response getBuildUnitTestReport(\n                @QueryParam(\"currentProject\") @NotNull String currentProjectPath,\n                @QueryParam(\"reference\") @NotNull String buildReference,\n                @QueryParam(\"reportName\") @NotNull String reportName,\n                @QueryParam(\"artifactPath\") String artifactPath) {\n        if (SecurityUtils.getUser() == null)\n            throw new UnauthenticatedException();\n\n        var currentProject = getProject(currentProjectPath);","sourceCodeStart":885,"sourceCodeEnd":921,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/ai/TodResource.java#L885-L921","documentation":"While serializing code problems in get-build-code-problems, TodResource switches on the problem target type (BlobTarget, ContainerTarget, GeneralTarget). If problem.getTarget() is an unrecognized subclass, it throws ExplicitException with the target class name - an internal invariant violation indicating the report contains a target type this endpoint does not know how to render.","triggerScenarios":"A code problem report on the build contains a problem whose target type is not Blob/Container/General - typically after a OneDev upgrade introduced new target kinds while the running server/AI endpoint serializes with older handling, or a plugin produced a custom target.","commonSituations":"Server upgraded with mixed node versions (old AI class handling vs new report data from agent); custom plugin emitting new CodeProblem target implementations; corrupted or hand-crafted report data.","solutions":["Upgrade the OneDev server fully (server and agents) so the endpoint supports the new target type","Identify the class name printed in the message and check which job/plugin generated the report; update or remove that step","Re-run the build to regenerate the report with the current code version","Work around by querying the report via the standard REST reports endpoints instead of the TOD endpoint, or file a bug with the target class name"],"exampleFix":"// before: server v10.x reading report produced by v11 agent with new target type\n// after: upgrade server to matching version, then re-run build\n./dev.sh build && restart server","handlingStrategy":"try-catch","validationCode":"// Not preventable client-side; ensure server and CI agents run the same OneDev version before reading reports produced by new target types","typeGuard":null,"tryCatchPattern":"try { return await getBuildCodeProblems(params); } catch (e) { if (/unknown problem target type/i.test(e.message)) { logServerVersionMismatch(e.message); return fetchProblemsViaRestReports(buildId, reportName); } throw e; }","preventionTips":["Keep server and CI agent versions aligned, especially after upgrades","Re-run builds after server upgrades so reports match current serializers","Report the target class name from the message when filing bugs","Fall back to standard REST report endpoints for unknown target types"],"tags":["internal","reports","invariant"],"backgroundTag":"internal-invariant-violation","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"}