t8y2/dbx · error

Cassandra configfile is not a regular file: %s

Error message

Cassandra configfile is not a regular file: %s

What it means

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.

Source

Thrown at agents/drivers/cassandra-go/config_file.go:36

const javaDriverConfigPrefix = "datastax-java-driver."

func applyCassandraConfigFile(config *cassandraConfig, rawPath string) error {
	path, err := normalizeLocalFilePath(rawPath)
	if err != nil {
		return fmt.Errorf("invalid Cassandra configfile: %w", err)
	}
	if path == "" {
		return nil
	}
	info, err := os.Stat(path)
	if err != nil {
		if errors.Is(err, os.ErrNotExist) {
			return nil
		}
		return fmt.Errorf("read Cassandra configfile %s: %w", path, err)
	}
	if !info.Mode().IsRegular() {
		return fmt.Errorf("Cassandra configfile is not a regular file: %s", path)
	}
	parsed, err := hocon.ParseResource(path)
	if err != nil {
		return fmt.Errorf("parse Cassandra configfile %s: %w", path, err)
	}
	config.configFile = path
	if err := applyJavaDriverHOCON(config, parsed); err != nil {
		return fmt.Errorf("apply Cassandra configfile %s: %w", path, err)
	}
	return nil
}

func applyJavaDriverHOCON(config *cassandraConfig, parsed *hocon.Config) error {
	if value, ok, err := hoconDuration(parsed, javaDriverConfigPrefix+"basic.request.timeout"); err != nil {
		return err
	} else if ok {
		config.requestTimeout = value
	}

View on GitHub (pinned to c0390bff16)

Solutions

  1. Point configfile at the actual file, not a directory (e.g. /etc/odigos/cassandra.conf, not /etc/odigos/)
  2. If using a Kubernetes volume mount, use subPath to mount the single file
  3. Verify with `test -f <path>` in the container

Example fix

// before
configfile: "/etc/cassandra/configmap-dir"
// after
configfile: "/etc/cassandra/configmap-dir/cassandra.conf"
Defensive patterns

Strategy: validation

Validate before calling

if info, err := os.Stat(cfg.ConfigFile); err == nil && !info.Mode().IsRegular() {
    return fmt.Errorf("configfile %s must be a regular file, got %s", cfg.ConfigFile, info.Mode().Type())
}

Type guard

func isRegularFile(p string) bool {
    info, err := os.Stat(p)
    return err == nil && info.Mode().IsRegular()
}

Try / catch

info, err := os.Stat(path)
if err == nil && !info.Mode().IsRegular() {
    return fmt.Errorf("configfile must be a file path, %s is a %s", path, info.Mode().Type())
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/8e13a70a8ff85039. Report an issue: GitHub.