{"record":{"id":"625e198f60c4dd85","repo":"pinpoint-apm/pinpoint","slug":"unknown-tracesourcetype-code-code","errorCode":null,"errorMessage":"unknown TraceSourceType code:${code}","messagePattern":"unknown TraceSourceType code:(.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/TraceSourceType.java","lineNumber":48,"sourceCode":"\n    private final byte code;\n\n    TraceSourceType(byte code) {\n        this.code = code;\n    }\n\n    public byte getCode() {\n        return this.code;\n    }\n\n    public static TraceSourceType of(byte code) {\n        if (code == PINPOINT.code) {\n            return PINPOINT;\n        }\n        if (code == OPENTELEMETRY.code) {\n            return OPENTELEMETRY;\n        }\n        throw new IllegalArgumentException(\"unknown TraceSourceType code:\" + code);\n    }\n}\n","sourceCodeStart":30,"sourceCodeEnd":51,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/TraceSourceType.java#L30-L51","documentation":"TraceSourceType.of maps a numeric code to one of the known TraceSourceType enum constants (currently PINPOINT and OPENTELEMETRY). Any other code has no mapping, so the factory throws this IllegalArgumentException to fail fast on unsupported trace source data.","triggerScenarios":"Decoding trace data whose traceSourceType field holds a code not in {PINPOINT, OPENTELEMETRY} — e.g. data written by a newer agent/collector with an added source type, or garbage/corrupted bytes in that field.","commonSituations":"Forward compatibility gaps: server version older than the agent that introduced a new TraceSourceType code; manually edited or corrupted trace rows; wrong byte offsets during custom deserialization.","solutions":["Upgrade the server/commons-server module so the enum knows the new code","Validate the source type code against supported values before decoding and skip unknown rows gracefully","Verify the deserialization offsets — a shifted byte stream can produce bogus codes"],"exampleFix":"// before\nTraceSourceType type = TraceSourceType.of(code); // throws for unknown codes\n// after\nTraceSourceType type;\ntry {\n    type = TraceSourceType.of(code);\n} catch (IllegalArgumentException e) {\n    logger.warn(\"Unknown trace source type \" + code + \", defaulting to PINPOINT\");\n    type = TraceSourceType.PINPOINT;\n}","handlingStrategy":"try-catch","validationCode":"TraceSourceType type = (code == TraceSourceType.PINPOINT.getCode())\n    ? TraceSourceType.PINPOINT\n    : (code == TraceSourceType.OPENTELEMETRY.getCode()) ? TraceSourceType.OPENTELEMETRY : null;\nif (type == null) { /* skip or default */ }","typeGuard":"TraceSourceType safeOf(int code) {\n    try { return TraceSourceType.of(code); }\n    catch (IllegalArgumentException e) { return null; }\n}","tryCatchPattern":"try {\n    type = TraceSourceType.of(code);\n} catch (IllegalArgumentException e) {\n    logger.warn(\"Unknown TraceSourceType code \" + code + \"; skipping or defaulting\", e);\n    type = TraceSourceType.PINPOINT;\n}","preventionTips":["Keep server/commons-server upgraded to at least the agent version that emits the data","Validate source type codes at ingestion and quarantine unknown values","Confirm deserialization byte offsets when codes look like garbage"],"tags":["java","enum","forward-compatibility"],"backgroundTag":"unsupported-enum-value","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}