t8y2/dbx · error

apply Cassandra configfile %s: %w

Error message

apply Cassandra configfile %s: %w

What it means

The file parsed as HOCON successfully, but applying the datastax-java-driver settings to the internal cassandraConfig failed inside applyJavaDriverHOCON. The wrapped error carries the specific semantic problem (e.g. bad duration/int value, invalid consistency name).

Source

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

		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 {
			return err
		}
		config.consistency = value
	}

View on GitHub (pinned to c0390bff16)

Solutions

  1. Read the wrapped cause to find the exact offending key and value
  2. Correct the value format (durations like '5s', integers without units)
  3. Remove unsupported/optional keys until the config applies cleanly
  4. Test the file with a minimal config first, then add keys back incrementally

Example fix

// before
datastax-java-driver { basic { request.timeout = 10 seconds } }
// after
datastax-java-driver { basic { request.timeout = "10s" } }
Defensive patterns

Strategy: validation

Validate before calling

parsed, err := hocon.ParseResource(cfg.ConfigFile)
if err == nil {
    if _, err := parsed.GetDuration("datastax-java-driver.basic.request.timeout"); err != nil {
        return fmt.Errorf("bad request.timeout: %w", err)
    }
}

Try / catch

if err := parseCassandraConfig(raw); err != nil {
    if strings.Contains(err.Error(), "apply Cassandra configfile") {
        return fmt.Errorf("a datastax-java-driver.* value is semantically invalid, fix the wrapped key: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: A HOCON key like datastax-java-driver.basic.request.timeout holds a value that cannot be converted (non-numeric duration, invalid consistency string, out-of-range page-size).

Common situations: Values written in Java-driver formats this Go wrapper doesn't accept (e.g. '10 seconds' vs '10s'); typo'd consistency names; setting serial-consistency to a non-SERIAL value.

Related errors


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