{"record":{"id":"97b79f78ec8f6c6b","repo":"grpc/grpc-java","slug":"no-alts-context-information-found","errorCode":null,"errorMessage":"No ALTS context information found","messagePattern":"No ALTS context information found","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"alts/src/main/java/io/grpc/alts/AltsContextUtil.java","lineNumber":64,"sourceCode":"   * @param call the {@link ClientCall} containing the ALTS information\n   * @return the created {@link AltsContext}\n   * @throws IllegalArgumentException if the {@link ClientCall} has no ALTS information.\n   */\n  public static AltsContext createFrom(ClientCall<?, ?> call) {\n    return createFrom(call.getAttributes());\n  }\n\n  /**\n   * Creates an {@link AltsContext} from ALTS context information in the {@link Attributes}.\n   *\n   * @param attributes the {@link Attributes} containing the ALTS information\n   * @return the created {@link AltsContext}\n   * @throws IllegalArgumentException if the {@link Attributes} has no ALTS information.\n   */\n  public static AltsContext createFrom(Attributes attributes) {\n    Object authContext = attributes.get(AltsProtocolNegotiator.AUTH_CONTEXT_KEY);\n    if (!(authContext instanceof AltsInternalContext)) {\n      throw new IllegalArgumentException(\"No ALTS context information found\");\n    }\n    return new AltsContext((AltsInternalContext) authContext);\n  }\n\n  /**\n   * Checks if the {@link ServerCall} contains ALTS information.\n   *\n   * @param call the {@link ServerCall} to check\n   * @return true, if the {@link ServerCall} contains ALTS information and false otherwise.\n   */\n  public static boolean check(ServerCall<?, ?> call) {\n    return check(call.getAttributes());\n  }\n\n  /**\n   * Checks if the {@link ClientCall} contains ALTS information.\n   *\n   * @param call the {@link ClientCall} to check","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/grpc/grpc-java/blob/64daddc1f3d1975670f769f3e97bde8b2ba32d25/alts/src/main/java/io/grpc/alts/AltsContextUtil.java#L46-L82","documentation":"AltsContextUtil.createFrom() extracts an ALTS peer context from the call Attributes map. The Attributes must contain AltsProtocolNegotiator.AUTH_CONTEXT_KEY holding an AltsInternalContext; when the attribute is absent or holds a different type, no ALTS handshake information is available and the method throws IllegalArgumentException.","triggerScenarios":"Calling AltsContextUtil.createFrom() on call attributes that did not come from an ALTS-negotiated channel — e.g. attributes from a plaintext or TLS channel, or calling it before the ALTS handshake populated the auth context.","commonSituations":"Developers using a shared interceptor across ALTS and non-ALTS servers call createFrom() unconditionally; or a server is configured without the ALTS protocol negotiator so the AUTH_CONTEXT_KEY is never attached.","solutions":["Guard the call with AltsContextUtil.isAltsServerCall() (or check the attributes contain AltsProtocolNegotiator.AUTH_CONTEXT_KEY) before calling createFrom()","Ensure both client and server use AltsChannelBuilder/AltsServerBuilder so the ALTS protocol negotiator is installed","Wrap createFrom() in try-catch for IllegalArgumentException and fall back to non-ALTS peer-identity handling"],"exampleFix":"// before\nAltsContext ctx = AltsContextUtil.createFrom(call.getAttributes());\n// after\nif (AltsContextUtil.isAltsServerCall(call.getAttributes())) {\n  AltsContext ctx = AltsContextUtil.createFrom(call.getAttributes());\n} else {\n  // non-ALTS call: skip ALTS peer identity\n}","handlingStrategy":"validation","validationCode":"if (!AltsContextUtil.isAltsServerCall(call.getAttributes())) {\n  throw new Status.UNAVAILABLE.withDescription(\"not an ALTS call\").asRuntimeException();\n}\nAltsContext ctx = AltsContextUtil.createFrom(call.getAttributes());","typeGuard":"boolean isAlts = attributes.get(AltsProtocolNegotiator.AUTH_CONTEXT_KEY) instanceof AltsInternalContext;","tryCatchPattern":"try {\n  AltsContext ctx = AltsContextUtil.createFrom(attrs);\n} catch (IllegalArgumentException e) {\n  // non-ALTS transport; fall back to TLS peer identity or reject\n}","preventionTips":["Check isAltsServerCall()/attribute presence before extracting ALTS context","Install the ALTS protocol negotiator via AltsServerBuilder on servers that should expose ALTS identity","Write interceptors that branch on transport type instead of assuming ALTS"],"tags":["grpc","alts","java","security"],"backgroundTag":"missing-required-argument","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"}