{"record":{"id":"9b10f58a3b3b4094","repo":"t8y2/dbx","slug":"parse-cassandra-configfile-s-w","errorCode":null,"errorMessage":"parse Cassandra configfile %s: %w","messagePattern":"parse Cassandra configfile (.+?): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/cassandra-go/config_file.go","lineNumber":40,"sourceCode":"\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid Cassandra configfile: %w\", err)\n\t}\n\tif path == \"\" {\n\t\treturn nil\n\t}\n\tinfo, err := os.Stat(path)\n\tif err != nil {\n\t\tif errors.Is(err, os.ErrNotExist) {\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"read Cassandra configfile %s: %w\", path, err)\n\t}\n\tif !info.Mode().IsRegular() {\n\t\treturn fmt.Errorf(\"Cassandra configfile is not a regular file: %s\", path)\n\t}\n\tparsed, err := hocon.ParseResource(path)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"parse Cassandra configfile %s: %w\", path, err)\n\t}\n\tconfig.configFile = path\n\tif err := applyJavaDriverHOCON(config, parsed); err != nil {\n\t\treturn fmt.Errorf(\"apply Cassandra configfile %s: %w\", path, err)\n\t}\n\treturn nil\n}\n\nfunc applyJavaDriverHOCON(config *cassandraConfig, parsed *hocon.Config) error {\n\tif value, ok, err := hoconDuration(parsed, javaDriverConfigPrefix+\"basic.request.timeout\"); err != nil {\n\t\treturn err\n\t} else if ok {\n\t\tconfig.requestTimeout = value\n\t}\n\tif value, ok, err := hoconString(parsed, javaDriverConfigPrefix+\"basic.request.consistency\"); err != nil {\n\t\treturn err\n\t} else if ok {\n\t\tif _, err := gocql.ParseConsistencyWrapper(value); err != nil {","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/cassandra-go/config_file.go#L22-L58","documentation":"Wraps a hocon.ParseResource failure: the config file exists and is a regular file but its contents are not valid HOCON. This catches syntax errors such as unbalanced braces, missing quotes, or invalid key syntax.","triggerScenarios":"configfile points to a file with malformed HOCON syntax (missing closing brace, unquoted value with special chars, duplicate keys in a way HOCON rejects), or a file in the wrong format entirely (e.g. YAML).","commonSituations":"Hand-editing the config and breaking syntax; copying a YAML Cassandra config instead of a HOCON/datastax-java-driver style one; BOM or encoding issues at file start.","solutions":["Validate the file with a HOCON parser/linter (e.g. typesafe config or pyhocon) and fix the syntax error reported by the wrapped %w error","Ensure the file uses HOCON syntax with the datastax-java-driver.* prefix for options","Check file encoding (UTF-8, no BOM issues)","Diff against a known-good example config"],"exampleFix":"// before\nbasic {\n  request-timeout = 10s\n// after\nbasic {\n  request-timeout = \"10s\"\n}","handlingStrategy":"validation","validationCode":"if _, err := hocon.ParseResource(cfg.ConfigFile); err != nil {\n    return fmt.Errorf(\"configfile %s is not valid HOCON: %w\", cfg.ConfigFile, err)\n}","typeGuard":null,"tryCatchPattern":"if err := parseCassandraConfig(raw); err != nil {\n    var pe *hocon.ParseError\n    if errors.As(err, &pe) {\n        return fmt.Errorf(\"HOCON syntax error at line/offset %v: %w\", pe.Position(), pe)\n    }\n    return err\n}","preventionTips":["Validate HOCON files in CI with a parser before packaging","Keep config files UTF-8 without BOM","Never paste YAML into a .conf intended for HOCON parsing"],"tags":["cassandra","config","hocon","parsing"],"backgroundTag":"config-parse-error","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"}