{"record":{"id":"378123f67a3c293d","repo":"grpc/grpc-go","slug":"unknown-resulted-record-protocol-v","errorCode":null,"errorMessage":"unknown resulted record protocol %v","messagePattern":"unknown resulted record protocol (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"credentials/alts/internal/handshaker/handshaker.go","lineNumber":290,"sourceCode":"\t\t}\n\t}\n\n\tvar extra []byte\n\tif req.GetServerStart() != nil {\n\t\tif resp.GetBytesConsumed() > uint32(len(req.GetServerStart().GetInBytes())) {\n\t\t\treturn nil, nil, errOutOfBound\n\t\t}\n\t\textra = req.GetServerStart().GetInBytes()[resp.GetBytesConsumed():]\n\t}\n\tresult, extra, err := h.processUntilDone(resp, extra)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\t// The handshaker returns a 128 bytes key. It should be truncated based\n\t// on the returned record protocol.\n\tkeyLen, ok := keyLength[result.RecordProtocol]\n\tif !ok {\n\t\treturn nil, nil, fmt.Errorf(\"unknown resulted record protocol %v\", result.RecordProtocol)\n\t}\n\tmaxFrameSize := int(envconfig.ALTSMaxFrameSize)\n\tif peerMax := int(result.GetMaxFrameSize()); peerMax > 0 {\n\t\tmaxFrameSize = min(peerMax, maxFrameSize)\n\t}\n\tsc, err := conn.NewConnWithMaxFrameSize(h.conn, h.side, result.GetRecordProtocol(), result.KeyData[:keyLen], extra, maxFrameSize)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn sc, result, nil\n}\n\nfunc (h *altsHandshaker) accessHandshakerService(req *altspb.HandshakerReq) (*altspb.HandshakerResp, error) {\n\tif err := h.stream.Send(req); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to send ALTS handshaker request: %w\", err)\n\t}\n\tresp, err := h.stream.Recv()\n\tif err != nil {","sourceCodeStart":272,"sourceCodeEnd":308,"githubUrl":"https://github.com/grpc/grpc-go/blob/0c51461d27177d997e14c642fe18c11668fc09a3/credentials/alts/internal/handshaker/handshaker.go#L272-L308","documentation":"Returned inside doHandshake when the completed HandshakerResult.RecordProtocol is not present in the local keyLength map (which only contains 'ALTSRP_GCM_AES128_REKEY' -> 44 bytes). Without a known key length, the handshake key cannot be truncated correctly, so the secure connection cannot be finalized.","triggerScenarios":"The GCP handshaker service completes a handshake and returns a result whose RecordProtocol is something other than ALTSRP_GCM_AES128_REKEY. doHandshake looks up keyLength[result.RecordProtocol], fails, and returns this error.","commonSituations":"Version skew: the GCP handshaker service (or a custom one) negotiated a newer/different record protocol than this grpc-go build understands; a custom handshaker returning a protocol name that isn't registered in the keyLength map; a test mock returning an arbitrary protocol string.","solutions":["Upgrade grpc-go to a version whose keyLength map includes the negotiated protocol.","If using a custom handshaker service, have it negotiate 'ALTSRP_GCM_AES128_REKEY' for clients/servers built on this grpc-go version.","Inspect HandshakerResult.RecordProtocol in logs to identify the unexpected protocol and file a grpc-go issue if against the standard GCP service."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Unknown record protocol from handshaker => version skew; fail and upgrade.\nif err != nil && strings.Contains(err.Error(), \"unknown resulted record protocol\") {\n    log.Printf(\"ALTS handshaker returned unsupported record protocol %v; upgrade grpc-go\", err)\n    return err\n}","preventionTips":["Pin grpc-go to a version that supports the record protocol your handshaker negotiates.","If developing a new ALTS record protocol, add it to the keyLength map and RegisterProtocol before deploying.","Ensure custom/mock handshakers return only registered protocols."],"tags":["grpc","alts","handshake","negotiation","version-mismatch"],"backgroundTag":null,"analyzedSha":"0c51461d27177d997e14c642fe18c11668fc09a3","analyzedAt":"2026-08-11T14:49:15.055Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}