gravitational/teleport · warning
too large: %v
Error message
too large: %v
What it means
parseBytes parses a human-readable byte size like '24mb' into an int. After multiplying the numeric part by the unit multiplier, if the resulting value is >= math.MaxInt32 it cannot safely fit in an int32-sized gRPC message size, so parseBytes rejects it with 'too large'. This guards against integer overflow when callers like MaxClientRecvMsgSize pass the result to grpc.MaxCallRecvMsgSize.
Source
Thrown at api/utils/grpc/size.go:83
}
lastDigit++
}
num := s[:lastDigit]
var value float32
if f, err := strconv.ParseFloat(num, 32); err == nil {
value = float32(f)
} else {
return 0, err
}
extra := strings.ToLower(strings.TrimSpace(s[lastDigit:]))
if m, ok := bytesSizeTable[extra]; ok {
value *= float32(m)
if value >= math.MaxInt32 {
return 0, fmt.Errorf("too large: %v", s)
}
return int(value), nil
}
return 0, fmt.Errorf("unhandled size name: %v", extra)
}
// MaxClientRecvMsgSize returns maximum message size in bytes the client can receive.
//
// By default 4MB is returned, to overwrite this, set `TELEPORT_UNSTABLE_GRPC_RECV_SIZE` envriroment
// variable. If the value cannot be parsed or exceeds int32 limits, the default value is returned.
//
// The result of this call can be passed directly into `grpc.MaxCallRecvMsgSize`, example:
//
// conn, err := grpc.DialContext(ctx, target,
// grpc.WithDefaultCallOptions(
// grpc.MaxCallRecvMsgSize(grpcutils.MaxClientRecvMsgSize()),
// ),View on GitHub (pinned to 1283425b60)
Solutions
- Set TELEPORT_UNSTABLE_GRPC_RECV_SIZE to a value below 2GiB, e.g. '2147483647' or '2gib' minus 1
- Remove the env var entirely to use the 4MB default
- If you truly need >2GB gRPC messages, that is unsupported by this parser; reduce message sizes instead (chunk/paginate payloads)
Example fix
// before export TELEPORT_UNSTABLE_GRPC_RECV_SIZE=5gib // after export TELEPORT_UNSTABLE_GRPC_RECV_SIZE=2gib # or 2147483647
Defensive patterns
Strategy: validation
Validate before calling
func validRecvSize(v string) bool {
s, err := grpcutils.ParseBytesPublic(v) // or replicate: parse number + unit, reject >= math.MaxInt32
return err == nil && s > 0 && s < math.MaxInt32
}
// check before setting: validRecvSize(os.Getenv("TELEPORT_UNSTABLE_GRPC_RECV_SIZE")) Try / catch
// Go: no panic possible; MaxClientRecvMsgSize already falls back to default
size := grpcutils.MaxClientRecvMsgSize()
if size == 4*1024*1024 && os.Getenv("TELEPORT_UNSTABLE_GRPC_RECV_SIZE") != "" {
log.Warnf("TELEPORT_UNSTABLE_GRPC_RECV_SIZE rejected, using 4MB default")
} Prevention
- Keep TELEPORT_UNSTABLE_GRPC_RECV_SIZE under 2GiB (int32 max is 2147483647)
- Remember MaxClientRecvMsgSize silently swallows parse errors and falls back to 4MB — log the env var at startup
- Prefer 'mib'/'gib' binary units and verify the effective value once at boot
When it happens
Trigger: Setting TELEPORT_UNSTABLE_GRPC_RECV_SIZE to a value whose numeric value times the unit multiplier reaches or exceeds 2147483647, e.g. '3gb' (3000000000), '2.5gib' (2684354560), or '3000000000b'.
Common situations: An operator sets the env var to '4g' or '10gb' hoping to raise the gRPC receive limit, not realizing the parser caps at int32; the error is silently swallowed by MaxClientRecvMsgSize which falls back to the 4MB default.
Related errors
- unhandled size name: %v
- conn was closed
- cannot route to empty target host
- unable to serve request due to an app configuration error. C
- no Access Graph fetchers
AI-assisted analysis of gravitational/teleport@1283425b60 (2026-09-02).
Data as JSON: /api/errors/c9111442c8a3b20f.
Report an issue: GitHub.