t8y2/dbx · error

invalid Hive thrift.client.max.message.size %q: expected byt

Error message

invalid Hive thrift.client.max.message.size %q: expected bytes

What it means

This error is returned when the Hive `thrift.client.max.message.size` DSN parameter is present but cannot be parsed by strconv.ParseInt as an integer number of bytes (32-bit range). The value is applied as the Thrift client MaxMessageSize int32. Non-integer or out-of-range values fail.

Source

Thrown at agents/drivers/argo-go/config.go:601

		parsed, err := strconv.Atoi(value)
		if err != nil || parsed <= 0 {
			return fmt.Errorf("invalid Hive fetchSize %q: expected a positive integer", value)
		}
		config.FetchSize = parsed
	}
	if value := parameter(values, "sockettimeout"); value != "" {
		parsed, err := strconv.ParseInt(value, 10, 64)
		if err != nil {
			return fmt.Errorf("invalid Hive socketTimeout %q: expected seconds", value)
		}
		if parsed > 0 {
			config.SocketTimeout = time.Duration(parsed) * time.Second
		}
	}
	if value := parameter(values, "thrift.client.max.message.size"); value != "" {
		parsed, err := strconv.ParseInt(value, 10, 32)
		if err != nil {
			return fmt.Errorf("invalid Hive thrift.client.max.message.size %q: expected bytes", value)
		}
		if parsed > 0 {
			config.MaxMessageSize = int32(parsed)
		}
	}
	if value := parameter(values, "retries"); value != "" {
		parsed, err := strconv.Atoi(value)
		if err == nil && parsed > 0 {
			config.Retries = parsed
		}
	}
	if value := parameter(values, "retryinterval"); value != "" {
		parsed, err := strconv.ParseInt(value, 10, 64)
		if err == nil && parsed >= 0 {
			config.RetryInterval = time.Duration(parsed) * time.Millisecond
		}
	}
	if value := parameter(values, "initfile"); value != "" {

View on GitHub (pinned to c0390bff16)

Solutions

  1. Set the parameter to a raw byte count as an integer, e.g. thrift.client.max.message.size=104857600
  2. Convert MB/GB to bytes (1 MB = 1048576) before putting it in the DSN
  3. Keep the value within the 32-bit signed integer range (max 2147483647)
  4. Remove the parameter to use the driver default

Example fix

// before
dsn := "hive://user:pass@host:10000/db?thrift.client.max.message.size=100mb"
// after
dsn := "hive://user:pass@host:10000/db?thrift.client.max.message.size=104857600"
Defensive patterns

Strategy: validation

Validate before calling

func validateMaxMessageSize(dsn string) error {
	vals, _ := url.ParseQuery(dsn)
	v := vals.Get("thrift.client.max.message.size")
	if v == "" { return nil }
	n, err := strconv.ParseInt(v, 10, 32)
	if err != nil {
		return fmt.Errorf("thrift.client.max.message.size must be bytes within int32 range, got %q", v)
	}
	return nil
}

Try / catch

if _, err := ParseConfig(dsn); err != nil && strings.Contains(err.Error(), "max.message.size") {
	return fmt.Errorf("use raw byte count (e.g. 104857600, not 100mb): %w", err)
}

Prevention

When it happens

Trigger: Opening a Hive connection with thrift.client.max.message.size="10mb", "2147483648" (> int32), or any non-integer value in the connection parameters.

Common situations: Specifying human-readable sizes ("10mb") instead of raw bytes; exceeding the 32-bit integer limit with very large byte counts; quotes or commas injected by templated config.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/02edd4986eed8a87. Report an issue: GitHub.