{"record":{"id":"eca6f62aa82efb2d","repo":"benbjohnson/litestream","slug":"cannot-access-database-w","errorCode":null,"errorMessage":"cannot access database: %w","messagePattern":"cannot access database: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/litestream/reset.go","lineNumber":71,"sourceCode":"\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)\n\t} else if err != nil {\n\t\treturn fmt.Errorf(\"cannot access database: %w\", err)\n\t}\n\n\t// Create DB instance\n\tvar db *litestream.DB\n\tif dbConfig != nil {\n\t\tdb, err = NewDBFromConfig(dbConfig)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"cannot create database from config: %w\", err)\n\t\t}\n\t} else {\n\t\tdb = litestream.NewDB(dbPath)\n\t}\n\n\t// Check if meta path exists\n\tmetaPath := db.MetaPath()\n\tif _, err := os.Stat(metaPath); os.IsNotExist(err) {\n\t\tfmt.Printf(\"No local state to reset for %s\\n\", dbPath)\n\t\tfmt.Printf(\"Meta directory does not exist: %s\\n\", metaPath)","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/cmd/litestream/reset.go#L53-L89","documentation":"Wraps a non-IsNotExist os.Stat failure on the database path in 'litestream reset'. Fires when the database path cannot be probed due to permission errors or other filesystem failures, so existence cannot be determined.","triggerScenarios":"Thrown at cmd/litestream/reset.go:71 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check permissions on the database path and parent directories","Run as a user with read access to the 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-14T00:17:10.932Z"}