{"record":{"id":"ef9fb06b12df152c","repo":"t8y2/dbx","slug":"invalid-s-expected-v3-v4-or-v5","errorCode":null,"errorMessage":"invalid %s: expected V3, V4, or V5","messagePattern":"invalid (.+?): expected V3, V4, or V5","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/cassandra-go/config_file.go","lineNumber":461,"sourceCode":"\t\t\treturn value, ok, err\n\t\t}\n\t}\n\treturn false, false, nil\n}\n\nfunc hoconProtocolVersion(config *hocon.Config, path string) (int, bool, error) {\n\tvalue := config.Get(path)\n\tif value == nil {\n\t\treturn 0, false, nil\n\t}\n\tvar raw string\n\tswitch typed := value.(type) {\n\tcase hocon.Int:\n\t\traw = strconv.Itoa(int(typed))\n\tcase hocon.String:\n\t\traw = string(typed)\n\tdefault:\n\t\treturn 0, false, fmt.Errorf(\"invalid %s: expected V3, V4, or V5\", path)\n\t}\n\traw = strings.TrimPrefix(strings.ToUpper(strings.TrimSpace(raw)), \"V\")\n\tversion, err := strconv.Atoi(raw)\n\tif err != nil || version < 3 || version > 5 {\n\t\treturn 0, false, fmt.Errorf(\"invalid %s: expected V3, V4, or V5\", path)\n\t}\n\treturn version, true, nil\n}\n","sourceCodeStart":443,"sourceCodeEnd":470,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/cassandra-go/config_file.go#L443-L470","documentation":"hoconProtocolVersion throws this when the protocol-version config value is a HOCON type other than Int or String (e.g. a boolean, object, or array). Only integer values 3–5 or strings like \"V3\", \"4\", \"v5\" are accepted.","triggerScenarios":"applyJavaDriverHOCON reading the protocol version key where the value is a non-scalar HOCON value (object, array, boolean, null).","commonSituations":"Nesting a protocol-version block by mistake so the key resolves to an object, or setting the key to an empty object/array due to a HOCON syntax slip.","solutions":["Set the key to a scalar: an integer 3, 4, or 5, or a string like \"V3\"/\"v4\".","Fix any accidental nesting (braces/brackets) around the key so it points at a scalar value.","Check that a commented-out or merged HOCON substitution is not replacing the key with an object."],"exampleFix":"// before\nprotocol-version = {}\n\n// after\nprotocol-version = V4","handlingStrategy":"validation","validationCode":"func validateProtocolVersionScalar(cfg *hocon.Config, path string) error {\n    v := cfg.Get(path)\n    if v == nil {\n        return nil\n    }\n    switch v.(type) {\n    case hocon.Int, hocon.String:\n        return nil\n    default:\n        return fmt.Errorf(\"%s must be an int 3-5 or a string like \\\"V4\\\", got %T\", path, v)\n    }\n}","typeGuard":"func isProtocolVersionScalar(v interface{}) bool {\n    switch v.(type) {\n    case hocon.Int, hocon.String:\n        return true\n    default:\n        return false\n    }\n}","tryCatchPattern":"ver, ok, err := hoconProtocolVersion(cfg, \"datastax-java-driver.advanced.protocol.version\")\nif err != nil {\n    return fmt.Errorf(\"protocol version must be a scalar (V3/V4/V5): %w\", err)\n}","preventionTips":["Set protocol version as a plain scalar: `V4` or `4`.","Do not nest or merge protocol-version into a block.","Test HOCON parsing in CI to catch structural mistakes early."],"tags":["configuration","hocon","cql-protocol-version","type-mismatch"],"backgroundTag":"invalid-config-value","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}