{"record":{"id":"20125e1d75ebbeed","repo":"t8y2/dbx","slug":"read-cassandra-configfile-s-w","errorCode":null,"errorMessage":"read Cassandra configfile %s: %w","messagePattern":"read Cassandra configfile (.+?): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/cassandra-go/config_file.go","lineNumber":33,"sourceCode":"\t\"github.com/gurkankaymak/hocon\"\n)\n\nconst 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","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/cassandra-go/config_file.go#L15-L51","documentation":"Wraps an os.Stat failure (other than not-exist) when checking the Cassandra config file. The path resolved fine but could not be stat'ed — typically a permission problem or an I/O error, not a missing file (missing files are silently ignored by design).","triggerScenarios":"configfile points to a path where os.Stat returns a non-ErrNotExist error: permission denied on a parent directory, I/O error, or a broken symlink resolution issue on some filesystems.","commonSituations":"Container running as non-root user without read access to the mounted config path; Kubernetes secret mounted with restrictive permissions; path inside a directory that is not readable/executable.","solutions":["Fix filesystem permissions (chmod/chown) so the process user can stat the file and traverse its directories","Verify the mount/volume is present in the container (kubectl exec + ls -la)","Check SELinux/AppArmor denials if permissions look correct","If the file is optional, ensure the wrapper environment grants at least search permission on parent dirs"],"exampleFix":"// before\n# /etc/odigos/cassandra.conf mode 0600 owned by root, agent runs as uid 10001\n// after\nchmod 0644 /etc/odigos/cassandra.conf && chown 10001 /etc/odigos/cassandra.conf","handlingStrategy":"validation","validationCode":"if _, err := os.Stat(cfg.ConfigFile); err != nil {\n    if !errors.Is(err, os.ErrNotExist) {\n        return fmt.Errorf(\"configfile %s not accessible: %w (check permissions/mount)\", cfg.ConfigFile, err)\n    }\n}","typeGuard":"func configFileAccessible(p string) bool {\n    _, err := os.Stat(p)\n    return err == nil || errors.Is(err, os.ErrNotExist)\n}","tryCatchPattern":"_, err := os.Stat(path)\nif err != nil && !errors.Is(err, os.ErrNotExist) {\n    return fmt.Errorf(\"cannot access Cassandra configfile %s: %w\", path, err)\n}","preventionTips":["Run the agent as a user with read access to mounted config volumes","Verify Kubernetes secret/configmap mounts with defaultMode permissions","Pre-flight os.Stat the configfile in entrypoint scripts"],"tags":["cassandra","config","permissions","file-io"],"backgroundTag":"permission-denied","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"}