{"record":{"id":"2a046fc6d54700e5","repo":"gravitational/teleport","slug":"unhandled-size-name-v","errorCode":null,"errorMessage":"unhandled size name: %v","messagePattern":"unhandled size name: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"api/utils/grpc/size.go","lineNumber":88,"sourceCode":"\n\tvar value float32\n\tif f, err := strconv.ParseFloat(num, 32); err == nil {\n\t\tvalue = float32(f)\n\t} else {\n\t\treturn 0, err\n\n\t}\n\n\textra := strings.ToLower(strings.TrimSpace(s[lastDigit:]))\n\tif m, ok := bytesSizeTable[extra]; ok {\n\t\tvalue *= float32(m)\n\t\tif value >= math.MaxInt32 {\n\t\t\treturn 0, fmt.Errorf(\"too large: %v\", s)\n\t\t}\n\t\treturn int(value), nil\n\t}\n\n\treturn 0, fmt.Errorf(\"unhandled size name: %v\", extra)\n}\n\n// MaxClientRecvMsgSize returns maximum message size in bytes the client can receive.\n//\n// By default 4MB is returned, to overwrite this, set `TELEPORT_UNSTABLE_GRPC_RECV_SIZE` envriroment\n// variable. If the value cannot be parsed or exceeds int32 limits, the default value is returned.\n//\n// The result of this call can be passed directly into `grpc.MaxCallRecvMsgSize`, example:\n//\n//\tconn, err := grpc.DialContext(ctx, target,\n//\t\tgrpc.WithDefaultCallOptions(\n//\t\t\tgrpc.MaxCallRecvMsgSize(grpcutils.MaxClientRecvMsgSize()),\n//\t\t),\n//\t)\nfunc MaxClientRecvMsgSize() int {\n\n\tval := os.Getenv(\"TELEPORT_UNSTABLE_GRPC_RECV_SIZE\")\n\tif val == \"\" {","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/gravitational/teleport/blob/1283425b60ec5f60d509ba4c791183d452923ff7/api/utils/grpc/size.go#L70-L106","documentation":"parseBytes only understands a fixed set of unit suffixes (b, k/kb/ki/kib, m/mb/mi/mib, g/gb/gi/gib, case-insensitive, or a bare number for bytes). If the text after the leading digits is not in bytesSizeTable, the suffix is unknown and the error 'unhandled size name' is returned. Note it does NOT support tb, pb, or full-word units like 'megabytes'.","triggerScenarios":"TELEPORT_UNSTABLE_GRPC_RECV_SIZE set to values with unsupported suffixes such as '100tb', '64MBytes', '1 MB' with the space included in the suffix after trimming (space is trimmed, but 'megs'/'terabyte' style units fail), or a typo like '100mibb'.","commonSituations":"Operators accustomed to Kubernetes quantity syntax ('128Mi', '1Ti') set '1ti' or use 't'/'tb' which are not in the table; the error is silently swallowed and the 4MB default is silently used.","solutions":["Use only supported units: b, k/kb/ki/kib, m/mb/mi/mib, g/gb/gi/gib (e.g. '32mib')","Remove the env var to fall back to the 4MB default","Check the exact value with: echo $TELEPORT_UNSTABLE_GRPC_RECV_SIZE and fix typos in the unit suffix"],"exampleFix":"// before\nexport TELEPORT_UNSTABLE_GRPC_RECV_SIZE=64Mi\n// after\nexport TELEPORT_UNSTABLE_GRPC_RECV_SIZE=64mib","handlingStrategy":"validation","validationCode":"var sizeUnits = map[string]bool{\"\": true, \"b\": true, \"k\": true, \"ki\": true, \"kb\": true, \"kib\": true, \"m\": true, \"mi\": true, \"mb\": true, \"mib\": true, \"g\": true, \"gi\": true, \"gb\": true, \"gib\": true}\nfunc validSizeSuffix(v string) bool {\n\tv = strings.ToLower(strings.TrimSpace(v))\n\ti := 0\n\tfor i < len(v) && (v[i] >= '0' && v[i] <= '9' || v[i] == '.') {\n\t\ti++\n\t}\n\treturn sizeUnits[strings.TrimSpace(v[i:])]\n}","typeGuard":null,"tryCatchPattern":"if !validSizeSuffix(val) { return fmt.Errorf(\"unsupported unit in %q; use b/k/kb/kib/m/mb/mib/g/gb/gib\", val) }","preventionTips":["Use only documented units: b, k/kb/ki/kib, m/mb/mi/mib, g/gb/gi/gib","Kubernetes-style 'Mi'/'Gi' shorthand maps to 'mi'/'gi' here — convert before setting","No 't'/'tb' support exists; values that large exceed int32 anyway"],"tags":["grpc","configuration","env-var","parsing"],"backgroundTag":"invalid-size-suffix","analyzedSha":"1283425b60ec5f60d509ba4c791183d452923ff7","analyzedAt":"2026-09-02T04:06:41.601Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}