gravitational/teleport · error

proto: CreateAuthenticateChallengeRequest: illegal tag %d (w

Error message

proto: CreateAuthenticateChallengeRequest: illegal tag %d (wire type %d)

What it means

Generated Unmarshal code for CreateAuthenticateChallengeRequest returned an illegal-tag error: fieldNum<=0 or an unknown/unskippable field. The stream deviates from the expected schema for this message.

Source

Thrown at api/client/proto/authservice.pb.go:60033

				return ErrIntOverflowAuthservice
			}
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= uint64(b&0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		if wireType == 4 {
			return fmt.Errorf("proto: CreateAuthenticateChallengeRequest: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: CreateAuthenticateChallengeRequest: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field UserCredentials", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowAuthservice
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= int(b&0x7F) << shift
				if b < 0x80 {

View on GitHub (pinned to 1283425b60)

Solutions

  1. Rebuild client and server against the same proto file versions
  2. Verify no middleware mutates or repackages the gRPC frame
  3. Validate payload structure with protoc --decode_raw
  4. Pin the api module version on both sides of the connection
Defensive patterns

Strategy: try-catch

Validate before calling

if len(payload) < 2 { return errors.New("payload too short for a protobuf message") }

Try / catch

var req proto.CreateAuthenticateChallengeRequest
if err := proto.Unmarshal(payload, &req); err != nil {
  return trace.AccessDenied("malformed challenge request")
}

Prevention

When it happens

Trigger: Decoding payload with an invalid or unrecognized field tag in CreateAuthenticateChallengeRequest, typically from mismatched proto versions or corrupted bytes.

Common situations: Client compiled against older proto where field numbers differ; proxy/intermediary rewriting messages; payload corruption in transit.

Understand the failure class

Background: "cannot parse invalid wire-format data", "cannot unmarshal", "failed unmarshalling": protobuf unmarshal errors explained — this error's family across 10 libraries.

Related errors


AI-assisted analysis of gravitational/teleport@1283425b60 (2026-09-02). Data as JSON: /api/errors/76e02517c19764f4. Report an issue: GitHub.