t8y2/dbx · error

parse Cassandra configfile %s: %w

Error message

parse Cassandra configfile %s: %w

What it means

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.

Source

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

	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
	}
	if value, ok, err := hoconString(parsed, javaDriverConfigPrefix+"basic.request.consistency"); err != nil {
		return err
	} else if ok {
		if _, err := gocql.ParseConsistencyWrapper(value); err != nil {

View on GitHub (pinned to c0390bff16)

Solutions

  1. 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
  2. Ensure the file uses HOCON syntax with the datastax-java-driver.* prefix for options
  3. Check file encoding (UTF-8, no BOM issues)
  4. Diff against a known-good example config

Example fix

// before
basic {
  request-timeout = 10s
// after
basic {
  request-timeout = "10s"
}
Defensive patterns

Strategy: validation

Validate before calling

if _, err := hocon.ParseResource(cfg.ConfigFile); err != nil {
    return fmt.Errorf("configfile %s is not valid HOCON: %w", cfg.ConfigFile, err)
}

Try / catch

if err := parseCassandraConfig(raw); err != nil {
    var pe *hocon.ParseError
    if errors.As(err, &pe) {
        return fmt.Errorf("HOCON syntax error at line/offset %v: %w", pe.Position(), pe)
    }
    return err
}

Prevention

When it happens

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

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

Related errors


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