{"record":{"id":"e8ef294e006f95e0","repo":"benbjohnson/litestream","slug":"no-sqlite-databases-found-in-directory-s-with-pat","errorCode":null,"errorMessage":"no SQLite databases found in directory %s with pattern %s","messagePattern":"no SQLite databases found in directory (.+?) with pattern (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/litestream/main.go","lineNumber":839,"sourceCode":"\t\treturn nil, fmt.Errorf(\"pattern is required for directory replication\")\n\t}\n\tif dbc.MetaPath != nil && dbc.MetaDir != nil {\n\t\treturn nil, fmt.Errorf(\"cannot specify both 'meta-path' and 'meta-dir'\")\n\t}\n\n\tdirPath, err := expand(dbc.Dir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Find all SQLite databases in the directory\n\tdbPaths, err := FindSQLiteDatabases(dirPath, dbc.Pattern, dbc.Recursive)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to scan directory %s: %w\", dirPath, err)\n\t}\n\n\tif len(dbPaths) == 0 && !dbc.Watch {\n\t\treturn nil, fmt.Errorf(\"no SQLite databases found in directory %s with pattern %s\", dirPath, dbc.Pattern)\n\t}\n\n\t// Create DB instances for each found database\n\tvar dbs []*litestream.DB\n\tmetaPaths := make(map[string]string)\n\n\tfor _, dbPath := range dbPaths {\n\t\tdb, err := newDBFromDirectoryEntry(dbc, dirPath, dbPath)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to create DB for %s: %w\", dbPath, err)\n\t\t}\n\n\t\t// Validate unique meta-path to prevent replication state corruption\n\t\tif mp := db.MetaPath(); mp != \"\" {\n\t\t\tif existingDB, exists := metaPaths[mp]; exists {\n\t\t\t\treturn nil, fmt.Errorf(\"meta-path collision: databases %s and %s would share meta-path %s, causing replication state corruption\", existingDB, dbPath, mp)\n\t\t\t}\n\t\t\tmetaPaths[mp] = dbPath","sourceCodeStart":821,"sourceCodeEnd":857,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/cmd/litestream/main.go#L821-L857","documentation":"The directory scan succeeded but matched zero SQLite databases. Litestream refuses to run directory replication with nothing to replicate — unless Watch mode is enabled, in which case it will keep monitoring for databases appearing later. The error includes both the directory and the pattern to help diagnose glob mistakes.","triggerScenarios":"NewDBsFromDirectoryConfig with Watch=false and FindSQLiteDatabases returning an empty slice — pattern matches no files in dirPath.","commonSituations":"Pattern doesn't match actual extensions (`*.sqlite` vs `.sqlite3` or `.db`); wrong directory path; databases haven't been created yet at startup; case-sensitivity mismatch on the glob.","solutions":["Verify the directory actually contains SQLite files: ls the path and compare with the pattern.","Broaden or correct the pattern (e.g. `*.db*` or `**/*.sqlite*`); remember globs are case-sensitive on Linux.","Set `watch: true` in the db config if databases may be created after litestream starts.","Confirm you pointed at the right directory (expanded env vars, correct container mount)."],"exampleFix":"# before\ndbs:\n  - dir: /data\n    pattern: \"*.sqlite\"\n\n# after (files are actually app1.db, app2.db)\ndbs:\n  - dir: /data\n    pattern: \"*.db\"\n    watch: true","handlingStrategy":"validation","validationCode":"matches, err := filepath.Glob(pattern)\nif err == nil && len(matches) == 0 {\n    return fmt.Errorf(\"pattern %q matches nothing in %s\", pattern, dirPath)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Test the glob with `ls /path/to/dir/*.db` before deploying.","Set `watch: true` when databases may not exist yet at startup.","Check actual file extensions on the target host (.db vs .sqlite vs .sqlite3)."],"tags":["config","litestream","glob","directory-replication"],"backgroundTag":"empty-result-set","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"}