BoundaryML/baml · error
No functions with tests found to optimize
Error message
No functions with tests found to optimize
What it means
The BAML optimizer orchestrator requires at least one BAML function that has test cases to run optimization against. It loads the intermediate representation (IR), filters functions by the configured function_filter, and fails fast if the filtered set is empty, since there is nothing to optimize. This is a deliberate bail in `Orchestrator::new` rather than a bug.
Solutions
- Add test cases (`test` blocks) to the BAML functions you want to optimize, since only functions with tests are eligible.
- Check your function_filter config and remove or correct it so it matches existing function names exactly.
- Run from the directory containing baml_src and verify `baml dev` lists the function you intend to optimize.
Example fix
// before (filter matches nothing)
let config = OptimizeConfig { function_filter: vec!["ClassifyyRequest".to_string()], ..Default::default() };
// after (exact function name that has tests)
let config = OptimizeConfig { function_filter: vec!["ClassifyRequest".to_string()], ..Default::default() }; Defensive patterns
Strategy: validation
Validate before calling
// Rust: before constructing the orchestrator
let ir = user_runtime.ir();
let fns = filter_functions(ir, &config.function_filter);
if fns.is_empty() {
eprintln!("No BAML functions with tests match filter {:?}; add tests or fix the filter", config.function_filter);
return;
} Prevention
- Give every optimizable BAML function at least one `test` block.
- Validate function_filter names against `baml dev`'s function list before running the optimizer.
- Run the optimizer from the project root so baml_src is discovered.
When it happens
Trigger: Calling the optimize entrypoint (Orchestrator::new) when `filter_functions(ir, &config.function_filter)` returns an empty list: no BAML functions match the filter, or the matching functions have no tests, or the BAML project has no functions at all.
Common situations: Running `baml optimize` (or the optimizer TUI) in a project whose baml_src contains only functions without tests; passing a --function filter name that is misspelled or does not exist; running the optimizer from the wrong directory so no BAML source is loaded.
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
- No candidates found in
- Configuration error
- Failed to parse client options for
- Invalid BAML_PLAYGROUND_DEV_PORT
- Playground server requires either BAML_PLAYGROUND_DEV_PORT…
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/8eb1dfb995cc5500.
Report an issue: GitHub.
Appendix: source
Thrown at engine/baml-runtime/src/optimize/orchestrator.rs:118
println!($($arg)*);
}
};
}
impl GEPAOrchestrator {
/// Create a new orchestrator
pub fn new(
user_runtime: Arc<BamlRuntime>,
gepa_runtime: GEPARuntime,
storage: OptimizationStorage,
config: OrchestratorConfig,
) -> Result<Self> {
// Find functions to optimize
let ir = user_runtime.ir();
let functions = filter_functions(ir, &config.function_filter);
if functions.is_empty() {
anyhow::bail!("No functions with tests found to optimize");
}
// For now, optimize the first matching function
// TODO: Support optimizing multiple functions
let function_name = functions.into_iter().next().unwrap();
let evaluator = Evaluator::new(config.env_vars.clone(), config.parallel);
let applier = CandidateApplier::new(
&config.baml_src_path,
config.env_vars.clone(),
config.feature_flags.clone(),
);
let pareto = ParetoFrontier::new(config.objectives.clone());
Ok(Self {
user_runtime,View on GitHub (pinned to bd85ce9dee)