{"record":{"id":"f448adc548a72267","repo":"benbjohnson/litestream","slug":"cannot-read-config-w","errorCode":null,"errorMessage":"cannot read config: %w","messagePattern":"cannot read config: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/litestream/reset.go","lineNumber":51,"sourceCode":"\t} else if fs.NArg() > 1 {\n\t\treturn fmt.Errorf(\"too many arguments\")\n\t}\n\n\tdbPath := fs.Arg(0)\n\n\t// Make absolute if needed\n\tif !filepath.IsAbs(dbPath) {\n\t\tif dbPath, err = filepath.Abs(dbPath); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Load configuration to find the database (if config exists)\n\tvar dbConfig *DBConfig\n\tif *configPath != \"\" {\n\t\tconfig, configErr := ReadConfigFile(*configPath, !*noExpandEnv)\n\t\tif configErr != nil {\n\t\t\treturn fmt.Errorf(\"cannot read config: %w\", configErr)\n\t\t}\n\n\t\t// Find database config\n\t\tfor _, dbc := range config.DBs {\n\t\t\texpandedPath := dbc.Path\n\t\t\tif !filepath.IsAbs(expandedPath) {\n\t\t\t\texpandedPath, _ = filepath.Abs(expandedPath)\n\t\t\t}\n\t\t\tif expandedPath == dbPath {\n\t\t\t\tdbConfig = dbc\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\t// If no config found, check if database file exists\n\tif _, err := os.Stat(dbPath); os.IsNotExist(err) {\n\t\treturn fmt.Errorf(\"database does not exist: %s\", dbPath)","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/cmd/litestream/reset.go#L33-L69","documentation":"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.","triggerScenarios":"Thrown at cmd/litestream/reset.go:51 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3","analyzedAt":"2026-09-06T18:29:25.564Z","contentChangedAt":"2026-09-06T18:29:25.564Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}