{"record":{"id":"c89b84ac8c8ef9ce","repo":"grpc/grpc-java","slug":"not-implemented","errorCode":null,"errorMessage":"Not implemented","messagePattern":"Not implemented","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"api/src/main/java/io/grpc/CallCredentials.java","lineNumber":99,"sourceCode":"     * Called when there has been an error when preparing the headers. This will fail the RPC.\n     */\n    public abstract void fail(Status status);\n  }\n\n  /**\n   * The request-related information passed to {@code CallCredentials.applyRequestMetadata()}.\n   */\n  public abstract static class RequestInfo {\n    /**\n     * The method descriptor of this RPC.\n     */\n    public abstract MethodDescriptor<?, ?> getMethodDescriptor();\n\n    /**\n     * The call options used to call this RPC.\n     */\n    public CallOptions getCallOptions() {\n      throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    /**\n     * The security level on the transport.\n     */\n    public abstract SecurityLevel getSecurityLevel();\n\n    /**\n     * Returns the authority string used to authenticate the server for this call.\n     */\n    public abstract String getAuthority();\n\n    /**\n     * Returns the transport attributes.\n     */\n    @Grpc.TransportAttr\n    public abstract Attributes getTransportAttrs();\n  }","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/grpc/grpc-java/blob/64daddc1f3d1975670f769f3e97bde8b2ba32d25/api/src/main/java/io/grpc/CallCredentials.java#L81-L117","documentation":"This is a placeholder method inside CallCredentials.RequestInfo: the default RequestInfo supplied by the library does not carry a CallOptions, so getCallOptions() deliberately throws UnsupportedOperationException. Only RequestInfo instances created by a real transport provide actual call options.","triggerScenarios":"Implementing a custom CallCredentials and calling requestInfo.getCallOptions() inside applyRequestMetadata when the RequestInfo was not supplied by a real gRPC transport (e.g. a hand-constructed RequestInfo, a mock, or the default returned by CallCredentials.RequestInfo's anonymous implementation).","commonSituations":"Unit tests of custom credential implementations that construct fake RequestInfo objects; code paths that copy the default RequestInfo; framework code (like the parameterPropagation test helper) invoking the method outside a real transport context.","solutions":["Do not rely on getCallOptions() in credentials logic; capture needed options elsewhere (e.g. pass them into your CallCredentials at construction)","In tests, provide a RequestInfo subclass/anonymous implementation that overrides getCallOptions() to return the desired CallOptions","Guard usage: only call getCallOptions() when the RequestInfo originated from an actual transport"],"exampleFix":"// before\nString authority = requestInfo.getCallOptions().getAuthority();\n// after\nprivate final String authority; // captured when credentials were constructed\npublic void applyRequestMetadata(RequestInfo info, Executor appExecutor, MetadataApplier applier) {\n  // use this.authority instead of info.getCallOptions()\n}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"boolean hasCallOptions(CallCredentials.RequestInfo info) {\n  try { info.getCallOptions(); return true; }\n  catch (UnsupportedOperationException e) { return false; }\n}","tryCatchPattern":"try {\n  CallOptions opts = requestInfo.getCallOptions();\n  // use opts\n} catch (UnsupportedOperationException e) {\n  // RequestInfo is not transport-backed; fall back to options captured at construction time\n}","preventionTips":["Never build logic around getCallOptions() in CallCredentials; carry needed values into the credentials object instead","In tests, provide RequestInfo implementations that override getCallOptions()","Treat RequestInfo as minimal: only getMethodDescriptor(), getAuthority(), and getSecurityLevel() are guaranteed"],"tags":["unsupported-operation","call-credentials","testing"],"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"}