{"record":{"id":"8e13a70a8ff85039","repo":"t8y2/dbx","slug":"cassandra-configfile-is-not-a-regular-file-s","errorCode":null,"errorMessage":"Cassandra configfile is not a regular file: %s","messagePattern":"Cassandra configfile is not a regular file: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/cassandra-go/config_file.go","lineNumber":36,"sourceCode":"const javaDriverConfigPrefix = \"datastax-java-driver.\"\n\nfunc applyCassandraConfigFile(config *cassandraConfig, rawPath string) error {\n\tpath, err := normalizeLocalFilePath(rawPath)\n\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}","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/cassandra-go/config_file.go#L18-L54","documentation":"Returned by applyCassandraConfigFile when the path referenced by the configfile option exists but is not a regular file (e.g. a directory, socket, or device). HOCON parsing only makes sense for a readable file, so a non-regular path is rejected after os.Stat; note that a non-existent path is silently ignored, but other stat errors are wrapped separately.","triggerScenarios":"configfile set to a directory path, a Unix socket, a named pipe, or /dev/null-like device node; os.Stat succeeds and info.Mode().IsRegular() is false.","commonSituations":"Kubernetes ConfigMap mounted as a directory while the config points at the mount root; typos omitting the filename; mounting a secret with defaultMode creating a symlinked dir layout misread as the target.","solutions":["Point configfile at the actual file, not a directory (e.g. /etc/odigos/cassandra.conf, not /etc/odigos/)","If using a Kubernetes volume mount, use subPath to mount the single file","Verify with `test -f <path>` in the container"],"exampleFix":"// before\nconfigfile: \"/etc/cassandra/configmap-dir\"\n// after\nconfigfile: \"/etc/cassandra/configmap-dir/cassandra.conf\"","handlingStrategy":"validation","validationCode":"if info, err := os.Stat(cfg.ConfigFile); err == nil && !info.Mode().IsRegular() {\n    return fmt.Errorf(\"configfile %s must be a regular file, got %s\", cfg.ConfigFile, info.Mode().Type())\n}","typeGuard":"func isRegularFile(p string) bool {\n    info, err := os.Stat(p)\n    return err == nil && info.Mode().IsRegular()\n}","tryCatchPattern":"info, err := os.Stat(path)\nif err == nil && !info.Mode().IsRegular() {\n    return fmt.Errorf(\"configfile must be a file path, %s is a %s\", path, info.Mode().Type())\n}","preventionTips":["Point configfile at the file, not a mounted directory","Use subPath volume mounts when mounting a single file in Kubernetes","Add `test -f \"$CONFIGFILE\"` to startup scripts"],"tags":["cassandra","config","file-io"],"backgroundTag":"invalid-file-path","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"}