BoundaryML/baml · error
no target specified. Pass a positional `<TARGET>` to pack on
Error message
no target specified. Pass a positional `<TARGET>` to pack one function as the binary's only entry point, or one or more `-f <NAME>` flags to pack a subcommand binary.
What it means
validate_flags rejects a `baml pack` invocation that names no pack target at all: neither a positional `<TARGET>` nor any `-f <NAME>` flag was given. Since `baml pack` cannot infer which function(s) to package, it bails with guidance on the two supported targeting styles.
Source
Thrown at baml_language/crates/baml_cli/src/pack_command.rs:252
if let Some(target) = self.target.as_deref() {
if looks_like_path(target) {
anyhow::bail!(
"positional `<TARGET>` is a function name, not a file path. \
For a single-file source, use `--file {target}` and pass the \
function via `-f <NAME>`. For example:\n\
\n `baml pack --file {target} -f <NAME>`\n",
);
}
if !self.functions.is_empty() {
anyhow::bail!(
"positional `<TARGET>` and `-f/--function` are mutually exclusive — \
use one or the other (positional packs a single-entry binary; \
`-f` produces a subcommand binary)."
);
}
}
if self.target.is_none() && self.functions.is_empty() {
anyhow::bail!(
"no target specified. Pass a positional `<TARGET>` to pack one \
function as the binary's only entry point, or one or more \
`-f <NAME>` flags to pack a subcommand binary."
);
}
Ok(())
}
fn resolved_target_triple(&self) -> Result<&str> {
match self.target_triple.as_deref() {
Some(target) => validate_release_target_triple(target),
None => release_host_target_triple(),
}
}
fn load_and_compile(&self, reporter: &Reporter) -> Result<(ProjectDatabase, Program, bool)> {
if let Some(file) = self.file.as_deref() {
// Standalone `--file` mode has no project root, so there is noView on GitHub (pinned to bd85ce9dee)
Solutions
- Pass a positional `<TARGET>` to pack one function as the binary's only entry point, e.g. `baml pack MyFunction`.
- Pass one or more `-f <NAME>` flags to pack a subcommand binary, e.g. `baml pack -f Foo -f Bar`.
- Use `baml run --list` to see available function names if unsure what to target.
Example fix
// before baml pack // after baml pack MyFunction // or baml pack -f MyFunction
Defensive patterns
Strategy: validation
Validate before calling
// ensure at least one target before invoking if [ -z "$TARGET" ] && [ -z "$FUNCTIONS" ]; then echo "usage: baml pack <TARGET> | baml pack -f NAME [-f NAME...]" >&2; exit 2 fi baml pack $TARGET $FUNCTIONS
Prevention
- Never invoke bare `baml pack`; always include a positional target or at least one `-f` flag.
- In scripts, fail early if target variables are empty (use ${VAR:?} expansion).
- Use `baml run --list` to pick valid targets when composing commands.
When it happens
Trigger: Running bare `baml pack` (or `baml pack --file <PATH>` with no `-f` and no positional) with no target and no functions specified.
Common situations: Users type `baml pack` expecting it to pack the whole project by default; a script drops the positional because a variable is empty; someone ports a `baml run` invocation that used different targeting flags.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- usage: baml toolchain install <canary|nightly|version>
- usage: baml toolchain use <canary|nightly|version|path>
- usage: baml toolchain pin <canary|nightly|version|path>
- usage: baml toolchain uninstall <version>
- the Go generator requires `--sdk-import-path <MODULE>/baml_s
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/ddca06c21f87331b.
Report an issue: GitHub.