t8y2/dbx · error

page size must be positive

Error message

page size must be positive

What it means

This library reads the Java Cassandra driver's HOCON configuration file and rejects any `basic.request.page-size` value below 1. A page size of 0 or negative is meaningless for the CQL protocol, which fetches rows in pages, so applyJavaDriverHOCON (config_file.go:79) returns this error instead of silently producing a driver that fetches nothing. It surfaces when applying a Cassandra config file during finalization.

Source

Thrown at agents/drivers/cassandra-go/config_file.go:79

		config.consistency = value
	}
	if value, ok, err := hoconString(parsed, javaDriverConfigPrefix+"basic.request.serial-consistency"); err != nil {
		return err
	} else if ok {
		consistency, err := gocql.ParseConsistencyWrapper(value)
		if err != nil {
			return err
		}
		if consistency != gocql.Serial && consistency != gocql.LocalSerial {
			return fmt.Errorf("serial consistency must be SERIAL or LOCAL_SERIAL")
		}
		config.serialConsistency = value
	}
	if value, ok, err := hoconInt(parsed, javaDriverConfigPrefix+"basic.request.page-size"); err != nil {
		return err
	} else if ok {
		if value < 1 {
			return fmt.Errorf("page size must be positive")
		}
		config.pageSize = value
	}
	if value, ok, err := hoconString(parsed, javaDriverConfigPrefix+"basic.load-balancing-policy.local-datacenter"); err != nil {
		return err
	} else if ok {
		config.localDatacenter = value
	}
	if value, ok, err := hoconString(parsed, javaDriverConfigPrefix+"basic.load-balancing-policy.class"); err != nil {
		return err
	} else if ok {
		policy, err := normalizeLoadBalancingPolicy(value)
		if err != nil {
			return err
		}
		config.loadBalancingPolicy = policy
	}
	if value, ok, err := hoconString(parsed, javaDriverConfigPrefix+"basic.cloud.secure-connect-bundle"); err != nil {

View on GitHub (pinned to c0390bff16)

Solutions

  1. Open the Cassandra HOCON config file and set `basic.request.page-size` to a positive integer (e.g. 5000, the Java driver default).
  2. If the value comes from a template/variable substitution, ensure the variable resolves to a number and not 0 or an empty interpolation.
  3. If you do not need to control paging, remove the page-size key entirely so the driver default is used.
  4. Prefer the library's native dbx.cassandra config keys instead of the Java-driver HOCON section if you were unaware page-size was being applied.

Example fix

// before (application.conf)
datastax-java-driver {
  basic.request.page-size = 0
}
// after
datastax-java-driver {
  basic.request.page-size = 5000
}
Defensive patterns

Strategy: validation

Validate before calling

func validatePageSize(cfg *hocon.Config) error {
    const key = "datastax-java-driver.basic.request.page-size"
    if cfg.Get(key) == nil {
        return nil
    }
    v, err := cfg.GetIntE(key)
    if err != nil {
        return err
    }
    if v < 1 {
        return fmt.Errorf("%s must be >= 1, got %d", key, v)
    }
    return nil
}

Type guard

func isValidPageSize(v int) bool { return v >= 1 }

Try / catch

if err := applyCassandraConfigFile(cfgPath); err != nil {
    if strings.Contains(err.Error(), "page size must be positive") {
        log.Fatalf("config %s: fix datastax-java-driver.basic.request.page-size to be >= 1", cfgPath)
    }
    return err
}

Prevention

When it happens

Trigger: A HOCON config file containing `datastax-java-driver { basic.request.page-size = 0 }` (or a negative number) is passed via applyCassandraConfigFile. Value is parsed by hoconInt and checked `value < 1` before assignment to config.pageSize.

Common situations: Hand-edited application.conf where someone set page-size to 0 thinking it means 'unlimited' or 'no paging'; templated configs with an unset variable interpolating to 0; porting a Java driver config where a placeholder was never filled in.

Understand the failure class

Background: Config validation failed: what "invalid value for {key}" and settings-rejection errors mean across 19 open-source libraries — this error's family across 19 libraries.

Related errors


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