{"record":{"id":"300066e7cfa53c6c","repo":"gravitational/teleport","slug":"proto-wrong-wiretype-d-for-field-id","errorCode":null,"errorMessage":"proto: wrong wireType = %d for field ID","messagePattern":"proto: wrong wireType = (.+?) for field ID","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/client/proto/authservice.pb.go","lineNumber":60670,"sourceCode":"\t\t\tb := dAtA[iNdEx]\n\t\t\tiNdEx++\n\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\tif b < 0x80 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tfieldNum := int32(wire >> 3)\n\t\twireType := int(wire & 0x7)\n\t\tif wireType == 4 {\n\t\t\treturn fmt.Errorf(\"proto: IdentityCenterAccount: wiretype end group for non-group\")\n\t\t}\n\t\tif fieldNum <= 0 {\n\t\t\treturn fmt.Errorf(\"proto: IdentityCenterAccount: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t}\n\t\tswitch fieldNum {\n\t\tcase 1:\n\t\t\tif wireType != 2 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field ID\", wireType)\n\t\t\t}\n\t\t\tvar stringLen uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowAuthservice\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tintStringLen := int(stringLen)\n\t\t\tif intStringLen < 0 {","sourceCodeStart":60652,"sourceCodeEnd":60688,"githubUrl":"https://github.com/gravitational/teleport/blob/1283425b60ec5f60d509ba4c791183d452923ff7/api/client/proto/authservice.pb.go#L60652-L60688","documentation":"Field ID of IdentityCenterAccount is declared as a string, which requires wire type 2 (length-delimited). The generated Unmarshal checks the wire type of field 1 and fails with this error when it differs. This indicates the bytes being decoded were not produced by the same compiled schema.","triggerScenarios":"Decoding an IdentityCenterAccount where field 1 (ID) carries a non-length-delimited wire type — e.g. an older schema where ID was an int, or corrupted framing that misreads the tag.","commonSituations":"Teleport version skew (auth server vs aws-integration agent), stale generated code after .proto edits, binary corruption in cached/stored records.","solutions":["Upgrade/downgrade so both sides share the same api/client/proto version.","Run make proto / regenerate bindings to match the current .proto.","Re-serialize or discard the corrupted record.","Confirm the producer marshals ID as string (wire type 2)."],"exampleFix":"// before: sender writes ID as int32\nAcctID: proto.Int64(id)\n// after: string ID matching schema\nID: strconv.FormatInt(id, 10)","handlingStrategy":"try-catch","validationCode":"// Ensure both sides agree on schema by checking the api module version at startup\nif apiVersion := version.API(); apiVersion != serverAPIVersion {\n  return fmt.Errorf(\"api version mismatch: client %s server %s\", apiVersion, serverAPIVersion)\n}","typeGuard":"func isStringField1(data []byte) bool {\n  // IdentityCenterAccount.ID is field 1, wire type 2 => key byte 0x0a\n  return len(data) > 0 && data[0] == 0x0a\n}","tryCatchPattern":"if err := proto.Unmarshal(data, &acct); err != nil {\n  if strings.Contains(err.Error(), \"field ID\") {\n    return fmt.Errorf(\"schema mismatch on IdentityCenterAccount.ID (upgrade client/server to same version): %w\", err)\n  }\n  return err\n}","preventionTips":["Bump the api dependency in plugins at the same time as server upgrades.","Commit regenerated pb.go files in the same PR as .proto changes.","Add integration tests that decode records written by the previous release.","Avoid editing proto field names/types in place; add new fields instead."],"tags":["protobuf","grpc","wire-format","version-skew","teleport"],"backgroundTag":"protobuf-wire-type-mismatch","analyzedSha":"1283425b60ec5f60d509ba4c791183d452923ff7","analyzedAt":"2026-09-02T04:06:41.601Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}