{"record":{"id":"64e8ad2ad271fc18","repo":"gravitational/teleport","slug":"proto-wrong-wiretype-d-for-field-deviceusage","errorCode":null,"errorMessage":"proto: wrong wireType = %d for field DeviceUsage","messagePattern":"proto: wrong wireType = (.+?) for field DeviceUsage","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/client/proto/authservice.pb.go","lineNumber":60564,"sourceCode":"\t\t\t}\n\t\t\tm.DeviceType = 0\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\tm.DeviceType |= DeviceType(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\tcase 3:\n\t\t\tif wireType != 0 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field DeviceUsage\", wireType)\n\t\t\t}\n\t\t\tm.DeviceUsage = 0\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\tm.DeviceUsage |= DeviceUsage(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\tcase 4:\n\t\t\tif wireType != 2 {","sourceCodeStart":60546,"sourceCodeEnd":60582,"githubUrl":"https://github.com/gravitational/teleport/blob/1283425b60ec5f60d509ba4c791183d452923ff7/api/client/proto/authservice.pb.go#L60546-L60582","documentation":"Thrown by the gogoproto-generated Unmarshal for a message with a DeviceUsage field (field number 3), declared as a varint enum. The decoder expects wire type 0 for this field; any other wire type on the wire is rejected with this error. It indicates the serialized bytes do not match the compiled schema.","triggerScenarios":"Decoding a device-related Auth Service message whose field 3 was encoded with wire type != 0 — e.g. a peer built from a .proto where DeviceUsage is a string or embedded message.","commonSituations":"Teleport version skew during rolling upgrades, forgetting to `make proto` after schema changes, plugins/terraform provider pinned to an older api release, or corrupt cached payloads.","solutions":["Use matching Teleport versions on both ends of the RPC (upgrade the older side).","Regenerate api/client/proto bindings from the current .proto.","Discard/re-serialize corrupted data produced under the old schema.","Verify the sender marshals DeviceUsage as an enum varint, not a string."],"exampleFix":"// before: mismatched api module (old plugin)\nrequire github.com/gravitational/teleport/api v0.0.0-old\n// after: pin api to the version matching the auth server\nrequire github.com/gravitational/teleport/api vX.Y.Z // same major/minor as server","handlingStrategy":"try-catch","validationCode":"// Verify sender/receiver schema agreement before decode:\n// marshal an empty message and compare field tags if unsure\nprobe, _ := proto.Marshal(&proto.DeviceUsageProbe{})\nif len(probe) == 0 { /* schema absent in this build */ }","typeGuard":"func isProtoWireErr(err error) bool {\n  var uwn gogoproto.Error // or check message text\n  return err != nil && strings.Contains(err.Error(), \"wrong wireType\")\n}","tryCatchPattern":"if err := proto.Unmarshal(data, &m); err != nil {\n  if strings.Contains(err.Error(), \"field DeviceUsage\") {\n    log.Warn(\"DeviceUsage wire mismatch; upgrading client recommended\")\n  }\n  return err\n}","preventionTips":["Keep api/client/proto generated in sync with the .proto (CI check on `git diff --exit-code api/client/proto`).","Avoid mixing Teleport versions inside one cluster during upgrades.","Treat cached protobuf blobs as versioned data; store a schema version alongside them.","Never hand-marshal enum fields; use the generated Marshal methods."],"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"}