t8y2/dbx · error

invalid Cassandra configfile: %w

Error message

invalid Cassandra configfile: %w

What it means

finalize() validates the Cassandra agent config before connecting. This error wraps a failure from normalizeLocalFilePath(config.configFile), meaning the local path configured for the driver configfile could not be resolved/normalized (e.g. missing file, unreadable path, or bad expansion). It is thrown when parseCassandraConfig finalizes user-supplied configuration.

Source

Thrown at agents/drivers/cassandra-go/config.go:432

		}
	}
	if config.debug {
		cluster.Logger = gocql.NewLogger(gocql.LogLevelDebug)
	}
	if err := applyRetryPolicies(cluster, config); err != nil {
		return nil, err
	}
	if err := applyLoadBalancingPolicy(cluster, config); err != nil {
		return nil, err
	}
	return cluster, nil
}

func (config *cassandraConfig) finalize() error {
	var err error
	config.configFile, err = normalizeLocalFilePath(config.configFile)
	if err != nil {
		return fmt.Errorf("invalid Cassandra configfile: %w", err)
	}
	config.secureConnectBundle, err = normalizeLocalFilePath(config.secureConnectBundle)
	if err != nil {
		return fmt.Errorf("invalid Cassandra secureconnectbundle: %w", err)
	}
	if config.secureConnectBundle != "" && config.kerberos.enabled {
		return fmt.Errorf("Cassandra secure connect bundles cannot be combined with Kerberos authentication")
	}
	if config.secureConnectBundle != "" && (config.username == "" || config.password == "") {
		return fmt.Errorf("Cassandra secure connect bundles require username and password credentials")
	}
	if config.kerberos.enabled {
		if err := config.kerberos.finalize(config.username, config.password); err != nil {
			return err
		}
	}
	return nil
}

View on GitHub (pinned to c0390bff16)

Solutions

  1. Verify the path in configFile exists and is readable from the process: ls -l <path>
  2. Use an absolute path instead of a relative or ~-expanded one
  3. Check that the underlying wrapped error (%w) names the actual cause and fix that
  4. Ensure the config file is copied/mounted into the container or working directory where the agent runs

Example fix

// before
config.configFile = "~/cassandra/config.conf"
// after
config.configFile = "/etc/instana/cassandra/config.conf" // absolute, verified to exist
Defensive patterns

Strategy: validation

Validate before calling

func validateConfigFile(path string) error {
	if path == "" {
		return nil // optional
	}
	info, err := os.Stat(path)
	if err != nil {
		return fmt.Errorf("configfile not accessible: %w", err)
	}
	if info.IsDir() {
		return fmt.Errorf("configfile is a directory: %s", path)
	}
	return nil
}

Try / catch

cfg, err := parseCassandraConfig(...)
if err != nil {
	var pathErr *fs.PathError
	if errors.As(err, &pathErr) {
		log.Fatalf("fix configfile path %q: %v", pathErr.Path, pathErr.Err)
	}
	return err
}

Prevention

When it happens

Trigger: Setting the configFile option to a path that normalizeLocalFilePath cannot resolve: a nonexistent file, an empty/unresolvable expansion, or a path with invalid syntax, then calling parseCassandraConfig/finalize.

Common situations: Typo in the configfile path, pointing at a file mounted in a different container path, using ~ or env-var expansion that isn't available in the runtime environment, or deploying configs without the file present.

Related errors


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