t8y2/dbx · error

invalid Hive fetchSize %q: expected a positive integer

Error message

invalid Hive fetchSize %q: expected a positive integer

What it means

fetchSize controls row-chunk size for Hive fetches; the parameter must parse as an integer and be strictly positive. Atoi failure or values <= 0 produce this error during connection parameter validation.

Source

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

			return fmt.Errorf("invalid Hive browserResponsePort %q: expected 0-65535", value)
		}
		config.BrowserResponsePort = parsed
	}
	if value := parameter(values, "browserresponsetimeout"); value != "" {
		parsed, err := strconv.ParseInt(value, 10, 64)
		if err != nil || parsed <= 0 {
			return fmt.Errorf("invalid Hive browserResponseTimeout %q: expected positive seconds", value)
		}
		config.BrowserResponseTimeout = time.Duration(parsed) * time.Second
	}
	config.BrowserDisableSSLCheck = parameterBool(values, "browserdisablesslcheck")
	if strings.EqualFold(config.Auth, "JWT") && config.JWT == "" {
		return errors.New("Hive JWT authentication requires jwt or the JWT environment variable")
	}
	if value := parameter(values, "fetchsize"); value != "" {
		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 {

View on GitHub (pinned to c0390bff16)

Solutions

  1. Set fetchSize to a positive integer (e.g. 1000)
  2. Remove the parameter to use the driver's default fetch size
  3. Strip separators/units from the value before assigning it
  4. Validate numeric params from env/flags before building the DSN

Example fix

// before
dsn := "...;fetchSize=1,000"
// after
dsn := "...;fetchSize=1000"
Defensive patterns

Strategy: validation

Validate before calling

if v := params.Get("fetchSize"); v != "" {
    n, err := strconv.Atoi(v)
    if err != nil || n <= 0 {
        return fmt.Errorf("fetchSize %q must be a positive integer", v)
    }
}

Try / catch

if err := applyParams(values); err != nil {
    if strings.Contains(err.Error(), "fetchSize") {
        return fmt.Errorf("fetchSize must be a positive integer: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: Connection string with fetchSize=0, fetchSize=-100, or non-numeric values like fetchSize=auto or fetchSize=1000 rows.

Common situations: Setting 0 expecting the driver default; placeholders like fetchSize=N in generated DSNs; pasting numbers with thousands separators (fetchSize=1,000).

Understand the failure class

Background: "must be positive", "Invalid value": how libraries reject invalid parameter values (ValueError, ArgumentError, INVALID_PARAMETER_VALUE) — this error's family across 28 libraries.

Related errors


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