{"record":{"id":"b2b155c2e055e3ee","repo":"grpc/grpc-java","slug":"not-implemented-b2b155","errorCode":null,"errorMessage":"Not implemented","messagePattern":"Not implemented","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"api/src/main/java/io/grpc/ClientStreamTracer.java","lineNumber":157,"sourceCode":"  }\n\n  /**\n   * Factory class for {@link ClientStreamTracer}.\n   */\n  public abstract static class Factory {\n    /**\n     * Creates a {@link ClientStreamTracer} for a new client stream.  This is called inside the\n     * transport when it's creating the stream.\n     *\n     * @param info information about the stream\n     * @param headers the mutable headers of the stream. It can be safely mutated within this\n     *        method.  Changes made to it will be sent by the stream.  It should not be saved\n     *        because it is not safe for read or write after the method returns.\n     *\n     * @since 1.20.0\n     */\n    public ClientStreamTracer newClientStreamTracer(StreamInfo info, Metadata headers) {\n      throw new UnsupportedOperationException(\"Not implemented\");\n    }\n  }\n\n  /**\n   * Information about a stream.\n   *\n   * <p>Note this class doesn't override {@code equals()} and {@code hashCode}, as is the case for\n   * {@link CallOptions}.\n   *\n   * @since 1.20.0\n   */\n  @ExperimentalApi(\"https://github.com/grpc/grpc-java/issues/2861\")\n  public static final class StreamInfo {\n    private final CallOptions callOptions;\n    private final int previousAttempts;\n    private final boolean isTransparentRetry;\n    private final boolean isHedging;\n","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/grpc/grpc-java/blob/64daddc1f3d1975670f769f3e97bde8b2ba32d25/api/src/main/java/io/grpc/ClientStreamTracer.java#L139-L175","documentation":"ClientStreamTracer.Factory.newClientStreamTracer() is a convenience default whose base implementation deliberately throws UnsupportedOperationException; subclasses are expected to override it. Calling the factory without an override produces this error.","triggerScenarios":"Using a ClientStreamTracer.Factory (or anonymous subclass) that does not override newClientStreamTracer(StreamInfo, Metadata), then letting gRPC create a stream — e.g. via CallOptions.withStreamTracerFactory(...) with an empty factory body, or framework/test helpers (newSubstream, maxConcurrentRequests LB tests) that invoke the factory directly.","commonSituations":"Copy-pasted factory stubs left unimplemented; anonymous Factory instances created only to satisfy an API; upgrading gRPC where instrumentation code assumed a different factory hook; tests exercising tracers (singlePolicyTypicalWorkflow, childTracer) against a factory that was never completed.","solutions":["Override newClientStreamTracer(StreamInfo info, Metadata headers) in your Factory subclass and return a real ClientStreamTracer","If no tracing is needed, return a no-op ClientStreamTracer instead of relying on the default","In tests, use or extend a no-op/fake tracer factory rather than instantiating ClientStreamTracer.Factory directly"],"exampleFix":"// before\nClientStreamTracer.Factory factory = new ClientStreamTracer.Factory() {};\n// after\nClientStreamTracer.Factory factory = new ClientStreamTracer.Factory() {\n  @Override\n  public ClientStreamTracer newClientStreamTracer(StreamInfo info, Metadata headers) {\n    return new ClientStreamTracer() {}; // no-op tracer\n  }\n};","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  ClientStreamTracer tracer = factory.newClientStreamTracer(info, headers);\n} catch (UnsupportedOperationException e) {\n  tracer = new ClientStreamTracer() {}; // no-op fallback\n}","preventionTips":["Always override newClientStreamTracer when subclassing ClientStreamTracer.Factory","Add a unit test that invokes factory.newClientStreamTracer with a minimal StreamInfo/Metadata","Prefer returning a no-op tracer over relying on default (throwing) implementations"],"tags":["unsupported-operation","tracing","abstract-method","stream"],"backgroundTag":"method-not-implemented","analyzedSha":"64daddc1f3d1975670f769f3e97bde8b2ba32d25","analyzedAt":"2026-09-08T06:14:57.704Z","contentChangedAt":"2026-09-08T06:14:57.704Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}