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 means the 'thrift.client.max.message.size' parameter could not be parsed as an integer number of bytes. The driver parses it with ParseInt(value, 10, 32) and assigns it to MaxMessageSize as an int32, so fractional, unit-suffixed, or out-of-int32-range values are rejected. It is thrown during DSN parsing in config.go before any connection is made.

Source

Thrown at agents/drivers/hive-go/config.go:604

		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. Convert the size to a plain integer byte count, e.g. 100MB -> 104857600
  2. Ensure the value fits in a signed 32-bit integer (max 2147483647)
  3. Remove the parameter to use the driver's default max message size

Example fix

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

Strategy: validation

Validate before calling

func validMaxMessageSize(v string) bool {
	n, err := strconv.ParseInt(v, 10, 32)
	return err == nil && n > 0 && n <= math.MaxInt32
}
// e.g. validate "104857600" passes, "100MB" fails

Try / catch

if _, err := driver.Open(dsn); err != nil {
	if strings.Contains(err.Error(), "thrift.client.max.message.size") {
		return fmt.Errorf("fix DSN: %w", err)
	}
	return err
}

Prevention

When it happens

Trigger: Passing thrift.client.max.message.size=100MB, =1048576.0, or a value larger than 2147483647 in the Hive DSN / parameter map.

Common situations: Specifying the size with a human unit (MB/GB) instead of raw bytes; pasting a 64-bit byte count that overflows int32; copying a setting from a different driver that accepts byte-size strings.

Related errors


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