{"record":{"id":"1168a949e77944c3","repo":"t8y2/dbx","slug":"protocolversion-must-be-between-3-and-5","errorCode":null,"errorMessage":"protocolversion must be between 3 and 5","messagePattern":"protocolversion must be between 3 and 5","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/cassandra-go/config.go","lineNumber":184,"sourceCode":"\t\tswitch key {\n\t\tcase \"localdatacenter\", \"datacenter\", \"dc\":\n\t\t\tconfig.localDatacenter = value\n\t\tcase \"requesttimeout\", \"timeout\":\n\t\t\tduration, err := parseDurationOption(value)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"invalid requesttimeout: %w\", err)\n\t\t\t}\n\t\t\tconfig.requestTimeout = duration\n\t\tcase \"connecttimeout\", \"logintimeout\":\n\t\t\tduration, err := parseDurationOption(value)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"invalid connecttimeout: %w\", err)\n\t\t\t}\n\t\t\tconfig.connectTimeout = duration\n\t\tcase \"protocolversion\", \"protoversion\":\n\t\t\tversion, err := strconv.Atoi(value)\n\t\t\tif err != nil || version < 3 || version > 5 {\n\t\t\t\treturn fmt.Errorf(\"protocolversion must be between 3 and 5\")\n\t\t\t}\n\t\t\tconfig.protocolVersion = version\n\t\tcase \"consistency\":\n\t\t\tif _, err := gocql.ParseConsistencyWrapper(value); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tconfig.consistency = value\n\t\tcase \"serialconsistency\":\n\t\t\tconsistency, err := gocql.ParseConsistencyWrapper(value)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif consistency != gocql.Serial && consistency != gocql.LocalSerial {\n\t\t\t\treturn fmt.Errorf(\"serialconsistency must be SERIAL or LOCAL_SERIAL\")\n\t\t\t}\n\t\t\tconfig.serialConsistency = value\n\t\tcase \"numconns\", \"connectionsperhost\":\n\t\t\tcount, err := strconv.Atoi(value)","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/cassandra-go/config.go#L166-L202","documentation":"The 'protocolversion' (alias 'protoversion') URL parameter must parse as an integer between 3 and 5 inclusive, matching the Cassandra CQL protocol versions gocql supports. Any non-integer, or a version outside 3-5, produces this validation error.","triggerScenarios":"protocolversion=2 (too old), protocolversion=4.0 (non-integer), protocolversion=v4, or protocolversion=6+ in a cassandra:// URL passed to parseCassandraConfig.","commonSituations":"Pointing a modern driver at a very old Cassandra 1.2 cluster (protocol v2), copying '4.0' from CQL version notation (confusing protocol version with CQL version), or upgrading a cluster and over-guessing the protocol version.","solutions":["Set protocolversion to 3, 4, or 5 to match the cluster's CQL native protocol version.","Remove protocolversion so the driver auto-negotiates the protocol with the server.","If you meant the CQL spec version, use the cqlversion parameter instead (e.g. cqlversion=3.4.4).","Check the server's protocol version (cqlsh or nodetool) and align the value."],"exampleFix":"// before\ncassandra://host:9042?protocolversion=4.0\n// after\ncassandra://host:9042?protocolversion=4","handlingStrategy":"validation","validationCode":"func validProtocolVersion(v string) error {\n\tn, err := strconv.Atoi(v)\n\tif err != nil || n < 3 || n > 5 {\n\t\treturn fmt.Errorf(\"protocolversion must be an integer 3-5, got %q\", v)\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":"cfg, err := parseCassandraConfig(dsn)\nif err != nil {\n\tif strings.Contains(err.Error(), \"protocolversion must be between 3 and 5\") {\n\t\treturn fmt.Errorf(\"fix protocolversion (integer 3-5) or remove it to auto-negotiate: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Prefer omitting protocolversion and letting the driver negotiate","Don't confuse CQL spec version (cqlversion=3.4.x) with native protocol version","Check the server's supported protocol versions before pinning one"],"tags":["cassandra","config","protocol-version","validation"],"backgroundTag":"invalid-protocol-version","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"}