benbjohnson/litestream · error
cannot read config: %w
Error message
cannot read config: %w
What it means
Wraps ReadConfigFile failure in the 'litestream reset' command. Fires when a -config path was supplied but the config file cannot be read or parsed (missing file, bad YAML, or env-expansion error), so the database's replica settings cannot be located for reset.
Source
Thrown at cmd/litestream/reset.go:51
} else if fs.NArg() > 1 {
return fmt.Errorf("too many arguments")
}
dbPath := fs.Arg(0)
// Make absolute if needed
if !filepath.IsAbs(dbPath) {
if dbPath, err = filepath.Abs(dbPath); err != nil {
return err
}
}
// Load configuration to find the database (if config exists)
var dbConfig *DBConfig
if *configPath != "" {
config, configErr := ReadConfigFile(*configPath, !*noExpandEnv)
if configErr != nil {
return fmt.Errorf("cannot read config: %w", configErr)
}
// Find database config
for _, dbc := range config.DBs {
expandedPath := dbc.Path
if !filepath.IsAbs(expandedPath) {
expandedPath, _ = filepath.Abs(expandedPath)
}
if expandedPath == dbPath {
dbConfig = dbc
break
}
}
}
// If no config found, check if database file exists
if _, err := os.Stat(dbPath); os.IsNotExist(err) {
return fmt.Errorf("database does not exist: %s", dbPath)View on GitHub (pinned to 4ed7a308f6)
Solutions
- Verify the config file path exists and is readable
- Check the YAML syntax and any $VAR expansion references
- Skip -config if resetting by direct database path
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at cmd/litestream/reset.go:51 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of benbjohnson/litestream@4ed7a308f6 (2026-09-06).
Data as JSON: /api/errors/f448adc548a72267.
Report an issue: GitHub.