{"record":{"id":"0462de1accf76278","repo":"pinpoint-apm/pinpoint","slug":"unsupported-operation-0462de","errorCode":null,"errorMessage":"UNSUPPORTED_OPERATION","messagePattern":"UNSUPPORTED_OPERATION","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/DisableTrace.java","lineNumber":116,"sourceCode":"    }\n\n    @Override\n    public void traceBlockEnd(int stackId) {\n        pop();\n    }\n\n    private int push() {\n        return this.depth++;\n    }\n\n    private void pop() {\n        this.depth--;\n    }\n\n\n    @Override\n    public TraceId getTraceId() {\n        throw new UnsupportedOperationException(UNSUPPORTED_OPERATION);\n    }\n\n    @Override\n    public boolean canSampled() {\n        // always return false\n        return false;\n    }\n\n    @Override\n    public boolean isRoot() {\n        return false;\n    }\n\n    @Override\n    public boolean isAsync() {\n        return false;\n    }\n","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/DisableTrace.java#L98-L134","documentation":"DisableTrace is Pinpoint's no-op Trace used when sampling is disabled; nearly all of its methods intentionally throw UnsupportedOperationException to signal that tracing operations are meaningless without an active sampled trace. getTraceId() is one of those stubs: a disabled trace has no trace context, so asking for its TraceId is unsupported. If you see this, code is interacting with a trace object that was never meant to carry real span data.","triggerScenarios":"Calling getTraceId() on a Trace obtained when canSampled() is false — i.e. the sampler decided not to sample the request (sampling rate 0, rate-limit sampling, or DisableTraceFactory produced the trace), and application or plugin code still calls trace.getTraceId().","commonSituations":"Applications that pass a Trace into custom interceptor/plugin code assuming it is always a real trace; sampling-rate misconfiguration making all traces disabled while instrumentation still queries trace IDs; tests injecting DisableTrace and exercising code paths that read the TraceId.","solutions":["Check trace.canSampled() before calling getTraceId(); treat a disabled trace as having no trace ID.","Wrap trace access in a null-object/facade that returns a placeholder TraceId (or skips logging) when sampling is off.","Fix sampling configuration (profiler.sampling.type / sampling.rate) if traces were expected to be sampled.","In plugin code, branch on whether the Trace is DisableTrace / isSampled and use the async or no-op variant appropriate for the interceptor.","Upgrade Pinpoint if a bundled plugin is calling getTraceId on disabled traces — newer versions guard against this."],"exampleFix":"// before\nString id = trace.getTraceId().getTransactionIdAsString();\n// after\nif (trace.canSampled()) {\n    String id = trace.getTraceId().getTransactionIdAsString();\n} else {\n    String id = null; // trace is disabled, no TraceId exists\n}","handlingStrategy":"validation","validationCode":"if (trace != null && trace.canSampled()) {\n    TraceId traceId = trace.getTraceId(); // safe\n} else {\n    // trace is disabled; skip trace-id usage\n}","typeGuard":"boolean isUsableTrace(com.navercorp.pinpoint.bootstrap.context.Trace t) {\n    return t != null && t.canSampled();\n}","tryCatchPattern":"try {\n    TraceId id = trace.getTraceId();\n} catch (UnsupportedOperationException e) {\n    logger.debug(\"Trace is disabled, no TraceId available\", e);\n}","preventionTips":["Always call canSampled() before any trace read operation","Treat DisableTrace as a null object: never persist or log from it","In plugins, branch on isSampled and use async/no-op trace variants","Test instrumentation with sampling disabled (rate=0) to catch these paths","Check sampling config when trace IDs are expected but absent"],"tags":["java","pinpoint","tracing","unsupported-operation","sampling"],"backgroundTag":"unsupported-operation","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}