{"record":{"id":"924e4f623e32e3bd","repo":"t8y2/dbx","slug":"page-size-must-be-positive","errorCode":null,"errorMessage":"page size must be positive","messagePattern":"page size must be positive","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/cassandra-go/config_file.go","lineNumber":79,"sourceCode":"\t\tconfig.consistency = value\n\t}\n\tif value, ok, err := hoconString(parsed, javaDriverConfigPrefix+\"basic.request.serial-consistency\"); err != nil {\n\t\treturn err\n\t} else if ok {\n\t\tconsistency, err := gocql.ParseConsistencyWrapper(value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif consistency != gocql.Serial && consistency != gocql.LocalSerial {\n\t\t\treturn fmt.Errorf(\"serial consistency must be SERIAL or LOCAL_SERIAL\")\n\t\t}\n\t\tconfig.serialConsistency = value\n\t}\n\tif value, ok, err := hoconInt(parsed, javaDriverConfigPrefix+\"basic.request.page-size\"); err != nil {\n\t\treturn err\n\t} else if ok {\n\t\tif value < 1 {\n\t\t\treturn fmt.Errorf(\"page size must be positive\")\n\t\t}\n\t\tconfig.pageSize = value\n\t}\n\tif value, ok, err := hoconString(parsed, javaDriverConfigPrefix+\"basic.load-balancing-policy.local-datacenter\"); err != nil {\n\t\treturn err\n\t} else if ok {\n\t\tconfig.localDatacenter = value\n\t}\n\tif value, ok, err := hoconString(parsed, javaDriverConfigPrefix+\"basic.load-balancing-policy.class\"); err != nil {\n\t\treturn err\n\t} else if ok {\n\t\tpolicy, err := normalizeLoadBalancingPolicy(value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tconfig.loadBalancingPolicy = policy\n\t}\n\tif value, ok, err := hoconString(parsed, javaDriverConfigPrefix+\"basic.cloud.secure-connect-bundle\"); err != nil {","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/cassandra-go/config_file.go#L61-L97","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Open the Cassandra HOCON config file and set `basic.request.page-size` to a positive integer (e.g. 5000, the Java driver default).","If the value comes from a template/variable substitution, ensure the variable resolves to a number and not 0 or an empty interpolation.","If you do not need to control paging, remove the page-size key entirely so the driver default is used.","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."],"exampleFix":"// before (application.conf)\ndatastax-java-driver {\n  basic.request.page-size = 0\n}\n// after\ndatastax-java-driver {\n  basic.request.page-size = 5000\n}","handlingStrategy":"validation","validationCode":"func validatePageSize(cfg *hocon.Config) error {\n    const key = \"datastax-java-driver.basic.request.page-size\"\n    if cfg.Get(key) == nil {\n        return nil\n    }\n    v, err := cfg.GetIntE(key)\n    if err != nil {\n        return err\n    }\n    if v < 1 {\n        return fmt.Errorf(\"%s must be >= 1, got %d\", key, v)\n    }\n    return nil\n}","typeGuard":"func isValidPageSize(v int) bool { return v >= 1 }","tryCatchPattern":"if err := applyCassandraConfigFile(cfgPath); err != nil {\n    if strings.Contains(err.Error(), \"page size must be positive\") {\n        log.Fatalf(\"config %s: fix datastax-java-driver.basic.request.page-size to be >= 1\", cfgPath)\n    }\n    return err\n}","preventionTips":["Treat page-size 0 as invalid in your config linting; 0 does not mean 'unlimited'.","Use the Java driver default (5000) unless paging behavior must be tuned.","Add a unit test asserting your shipped application.conf parses through the config-file loader.","Guard template variables so unset placeholders never interpolate to 0."],"tags":["cassandra","config-validation","hocon"],"backgroundTag":"config-validation-failed","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}