BoundaryML/baml · error
Found none of openapi-generator, openapi-generator-cli, or n
Error message
Found none of openapi-generator, openapi-generator-cli, or npx in PATH
What it means
`baml-cli init` can generate an OpenAPI spec, which requires the openapi-generator tool. infer_openapi_command probes PATH for `openapi-generator`, `openapi-generator-cli`, then `npx`; if none exists it bails with this message. It means the environment lacks any way to invoke OpenAPI generator.
Source
Thrown at engine/baml-runtime/src/cli/init.rs:54
const CLIENTS_BAML: &str = include_str!("initial_project/baml_src/clients.baml");
const RESUME_BAML: &str = include_str!("initial_project/baml_src/resume.baml");
/// TODO: one problem with this impl - this requires all users to install openapi-generator the same way
fn infer_openapi_command() -> Result<&'static str> {
if which("openapi-generator").is_ok() {
return Ok("openapi-generator");
}
if which("openapi-generator-cli").is_ok() {
return Ok("openapi-generator-cli");
}
if which("npx").is_ok() {
return Ok("npx @openapitools/openapi-generator-cli");
}
anyhow::bail!("Found none of openapi-generator, openapi-generator-cli, or npx in PATH")
}
#[derive(Debug)]
enum EditorType {
VSCode,
Cursor,
Unknown,
}
fn detect_editor() -> EditorType {
// Check for Cursor first since it might also set VSCode-like variables
if let Ok(cursor_trace_id) = env::var("CURSOR_TRACE_ID") {
if !cursor_trace_id.is_empty() {
return EditorType::Cursor;
}
}
// Then check TERM_PROGRAM for both VSCode and CursorView on GitHub (pinned to bd85ce9dee)
Solutions
- Install Node.js (which provides npx) so `npx @openapitools/openapi-generator-cli` works.
- Or install the generator directly: `npm install @openapitools/openapi-generator-cli -g` or brew install openapi-generator.
- Verify with `which npx` / `which openapi-generator` that the tool is on PATH in the shell running baml init.
- If you don't need OpenAPI output, check whether init has a flag to skip openapi generation.
Example fix
// before: baml init fails // after (macOS/Linux) npm install -g @openapitools/openapi-generator-cli baml init # now detects openapi-generator-cli
Defensive patterns
Strategy: validation
Validate before calling
# before running baml init
command -v openapi-generator || command -v openapi-generator-cli || command -v npx || { echo 'install openapi-generator or npx'; exit 1; } Try / catch
catch (e) {
if (String(e.message).includes('none of openapi-generator')) {
throw new Error('Install Node.js/npx or openapi-generator before baml init');
}
} Prevention
- Bake Node.js/npx into dev container and CI images.
- Document toolchain prerequisites (npx) in the project README.
- Check PATH in the exact shell/CI environment that runs baml init.
When it happens
Trigger: Running `baml init` (or the init command flow that requests OpenAPI generation) on a machine where none of openapi-generator, openapi-generator-cli, or npx are installed/on PATH.
Common situations: Fresh Docker images or CI runners without Node.js, missing PATH entries for nvm/homebrew-installed tools, minimal Linux environments.
Related errors
- toolchain path is a directory: {}{origin} Point at the {} bi
- toolchain binary not found: {}{origin}
- failed to install the BAML extension into {ide} automaticall
- Specified run directory does not exist: {}
- Expected --from '{}' to be a baml_src/ directory, but it doe
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/cbc2c419580d0492.
Report an issue: GitHub.