theonedev/onedev · error · ExplicitException

Unknown problem target type:

Error message

Unknown problem target type: 

What it means

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.

Source

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

        var problems = new ArrayList<Map<String, Object>>();
        for (var problem: report.getProblems()) {
            if (problem.getSeverity().ordinal() <= severityLevel.ordinal()) {
                var problemMap = new HashMap<String, Object>();
                problemMap.put("severity", problem.getSeverity().name());
                problemMap.put("message", problem.getMessage());
                if (problem.getTarget() instanceof BlobTarget blobTarget) {
                    problemMap.put("file", blobTarget.getGroupKey().getName());
                    if (blobTarget.getLocation() != null) {
                        problemMap.put("beginLine", blobTarget.getLocation().getFromRow() + 1);
                        problemMap.put("endLine", blobTarget.getLocation().getToRow() + 1);
                    }
                } else if (problem.getTarget() instanceof ContainerTarget containerTarget) {
                    problemMap.put("target", containerTarget.getGroupKey().getName());
                    problemMap.put("platform", ((ContainerTarget.GroupKey) containerTarget.getGroupKey()).getPlatform());
                } else if (problem.getTarget() instanceof GeneralTarget generalTarget) {
                    problemMap.put("target", generalTarget.getGroupKey().getName());
                } else {
                    throw new ExplicitException("Unknown problem target type: " + problem.getTarget().getClass().getName());
                }
                problems.add(problemMap);
            }
        }
        return problems;
    }

    @Path("/get-build-unit-test-report")
    @GET
    public Response getBuildUnitTestReport(
                @QueryParam("currentProject") @NotNull String currentProjectPath,
                @QueryParam("reference") @NotNull String buildReference,
                @QueryParam("reportName") @NotNull String reportName,
                @QueryParam("artifactPath") String artifactPath) {
        if (SecurityUtils.getUser() == null)
            throw new UnauthenticatedException();

        var currentProject = getProject(currentProjectPath);

View on GitHub (pinned to d44925c47c)

Solutions

  1. Upgrade the OneDev server fully (server and agents) so the endpoint supports the new target type
  2. Identify the class name printed in the message and check which job/plugin generated the report; update or remove that step
  3. Re-run the build to regenerate the report with the current code version
  4. 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

Example fix

// before: server v10.x reading report produced by v11 agent with new target type
// after: upgrade server to matching version, then re-run build
./dev.sh build && restart server
Defensive patterns

Strategy: try-catch

Validate before calling

// Not preventable client-side; ensure server and CI agents run the same OneDev version before reading reports produced by new target types

Try / catch

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; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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