t8y2/dbx · error

invalid Hive fetchSize %q: expected a positive integer

Error message

invalid Hive fetchSize %q: expected a positive integer

What it means

This error is returned while parsing a Hive connection string when the `fetchsize` parameter is present but cannot be parsed as a positive integer with strconv.Atoi. The library validates driver configuration at DSN-parse time so bad values fail fast instead of at query execution. It means the fetchSize value is either non-numeric or <= 0.

Source

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

			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 string, e.g. fetchsize=1000
  2. Remove the fetchsize parameter entirely to use the driver default
  3. Check for typos, stray units, or empty templated values in the DSN
  4. Verify environment/config templates do not inject quotes or commas into the value

Example fix

// before
dsn := "hive://user:pass@host:10000/db?fetchsize=0"
// after
dsn := "hive://user:pass@host:10000/db?fetchsize=1000"
Defensive patterns

Strategy: validation

Validate before calling

func validateFetchSize(dsn string) error {
	vals, _ := url.ParseQuery(dsn)
	v := vals.Get("fetchsize")
	if v == "" { return nil }
	n, err := strconv.Atoi(v)
	if err != nil || n <= 0 {
		return fmt.Errorf("fetchsize must be a positive integer, got %q", v)
	}
	return nil
}

Try / catch

cfg, err := drivers.ParseConfig(dsn)
if err != nil {
	var valErr *strconv.NumError
	if errors.As(err, &valErr) || strings.Contains(err.Error(), "fetchSize") {
		return fmt.Errorf("fix fetchsize in DSN: %w", err)
	}
	return err
}

Prevention

When it happens

Trigger: Opening a Hive connection with a DSN/parameter map containing fetchsize set to a non-integer string (e.g. "abc", "10.5", "1e3") or a non-positive integer (e.g. "0", "-5").

Common situations: Copy-pasting a connection string with a placeholder fetchsize; mistyping units (fetchsize=10k); setting fetchsize=0 expecting the driver default; templated config files rendering empty or quoted values into the DSN.

Related errors


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