tursodatabase/turso · error
no SQL files matched the query selection
Error message
no SQL files matched the query selection
What it means
The join benchmark loads SQL query files from a directory, optionally filtered by name substring or an explicit query-name list. If the resulting query set is empty — no file in --query-dir matched the filter/names — it aborts before opening the database.
Source
Thrown at perf/join-benchmark/main.rs:54
/// Number of measured executions for each query.
#[arg(long, default_value_t = 5)]
repetitions: usize,
/// Stop an execution after this many seconds. Zero disables the timeout.
#[arg(long, default_value_t = 30)]
timeout_seconds: u64,
/// Print each query plan as one JSON record. Do not execute the query.
#[arg(long)]
plans: bool,
}
fn main() -> Result<()> {
let args = Args::parse();
let queries = load_queries(&args.query_dir, args.filter.as_deref(), &args.query_names)?;
if queries.is_empty() {
bail!("no SQL files matched the query selection");
}
#[allow(clippy::arc_with_non_send_sync)]
let io = Arc::new(PlatformIO::new()?);
let database = Database::open(
io,
&args.database.to_string_lossy(),
OpenOptions::new(Arc::new(SqliteDialect)).flags(OpenFlags::ReadOnly),
)?;
let connection = database.connect()?;
for query in queries {
if args.plans {
print_plan(&connection, &query)?;
continue;
}
let mut statement = connectionView on GitHub (pinned to 492c4a71cd)
Solutions
- List the directory and check the .sql filenames: `ls <query-dir>/*.sql`.
- Fix --filter or --query-names to match actual file names (without or with extension, as load_queries expects).
- Point --query-dir at the directory that actually contains the SQL files.
- Run from the repository root or use an absolute path for --query-dir.
Example fix
// before cargo run -p join-benchmark -- --query-dir ./queries --query-names qkjoin_17 // after cargo run -p join-benchmark -- --query-dir ./queries --query-names q17
Defensive patterns
Strategy: validation
Validate before calling
fn validate_query_selection(dir: &std::path::Path, filter: Option<&str>) -> anyhow::Result<()> {
let any = std::fs::read_dir(dir)?
.filter_map(|e| e.ok())
.any(|e| e.file_name().to_string_lossy().ends_with(".sql")
&& filter.map_or(true, |f| e.file_name().to_string_lossy().contains(f)));
anyhow::ensure!(any, "no .sql files in {} match filter {:?}", dir.display(), filter);
Ok(())
} Prevention
- List the query directory before running with filters or explicit names
- Use tab-completion or exact filenames from `ls` for --query-names
- Use absolute paths for --query-dir to avoid cwd surprises
When it happens
Trigger: Running the join-benchmark binary with --filter matching no filenames, --query-names listing names that don't exist on disk, or pointing --query-dir at an empty/wrong directory.
Common situations: Typo in a query name; filter string that doesn't match any .sql file after a rename; query directory from another checkout or not populated; running from a working directory where the relative query path doesn't resolve.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- Failed to read manual page: {}
- Manual page not found: {page_name}
- Could not determine home directory
- Error setting Ctrl-C handler
- Page number must be a positive integer.
AI-assisted analysis of tursodatabase/turso@492c4a71cd (2026-09-13).
Data as JSON: /api/errors/ac3cffe44dcd982a.
Report an issue: GitHub.