{"record":{"id":"b3d68c8855b9ef0c","repo":"gravitational/teleport","slug":"proto-wrong-wiretype-d-for-field-accountname","errorCode":null,"errorMessage":"proto: wrong wireType = %d for field AccountName","messagePattern":"proto: wrong wireType = (.+?) for field AccountName","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/client/proto/authservice.pb.go","lineNumber":60734,"sourceCode":"\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 {\n\t\t\t\treturn ErrInvalidLengthAuthservice\n\t\t\t}\n\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\tif postIndex < 0 {\n\t\t\t\treturn ErrInvalidLengthAuthservice\n\t\t\t}\n\t\t\tif postIndex > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tm.ARN = string(dAtA[iNdEx:postIndex])\n\t\t\tiNdEx = postIndex\n\t\tcase 3:\n\t\t\tif wireType != 2 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field AccountName\", 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":60716,"sourceCodeEnd":60752,"githubUrl":"https://github.com/gravitational/teleport/blob/1283425b60ec5f60d509ba4c791183d452923ff7/api/client/proto/authservice.pb.go#L60716-L60752","documentation":"Field AccountName of IdentityCenterAccount is a string requiring wire type 2; the generated Unmarshal throws this error when the field 3 tag carries a different wire type. It signals the decoder and encoder disagree on the message schema.","triggerScenarios":"Decoding an IdentityCenterAccount whose field 3 is not length-delimited — typically a payload from a different Teleport api version or bytes corrupted after field 2 (ARN), shifting tag alignment.","commonSituations":"Rolling upgrade skew, stale vendored api module, truncation/corruption in storage or wire, hand-rolled encoders.","solutions":["Use the same Teleport version for all components communicating with the auth service.","Regenerate proto bindings if the .proto was changed.","Re-serialize or drop the corrupted record.","Capture a hex dump and verify field 3's key byte is 0x1a (tag 3, wire type 2)."],"exampleFix":"// before: decoding legacy bytes\nerr := proto.Unmarshal(legacyBytes, &acct) // mismatch\n// after: migrate via a converter of matching schema version\nlegacy := unmarshalWithOldSchema(legacyBytes)\nnewBytes, _ := proto.Marshal(migrate(legacy))\nerr := proto.Unmarshal(newBytes, &acct)","handlingStrategy":"try-catch","validationCode":"// Re-marshal after decode as a self-check before trusting the record:\n_, err := proto.Marshal(&proto.IdentityCenterAccount{Id: \"x\", Arn: \"arn\", AccountName: \"n\"})\nif err != nil { /* bindings out of sync */ }","typeGuard":null,"tryCatchPattern":"if err := proto.Unmarshal(data, &acct); err != nil {\n  if strings.Contains(err.Error(), \"field AccountName\") {\n    return fmt.Errorf(\"AccountName wire mismatch — check client/server api versions: %w\", err)\n  }\n  return err\n}","preventionTips":["Run rolling upgrades with wire-compatibility tests between adjacent releases.","Keep vendored api module fresh (`go get -u github.com/gravitational/teleport/api`).","Guard storage layers against truncated writes (checksums on records).","Use generated Marshal only; no manual tag construction for string fields."],"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"}