BoundaryML/baml · error
' ' contains an invalid org name (' ')
Error message
'{}' contains an invalid org name ('{}') What it means
ProjectFqn::parse splits a fully-qualified project name into org slug and project shortname and validates the org slug against ^[a-z0-9_][a-z0-9_-]*$. When the org portion contains characters outside that set (uppercase, dots, spaces, leading dash, etc.) parsing bails with this message naming both the full FQN and the offending org.
Solutions
- Lowercase the org name and replace invalid characters with '-' or '_' before parsing
- Ensure the org slug starts with a lowercase letter, digit, or underscore (not a dash)
- Normalize at the input boundary (CLI/API) so display names are slugged before becoming FQNs
- Surface the regex rules in the CLI error/UX so users know the constraint
Example fix
// before
let fqn = ProjectFqn::parse("MyOrg.MyProject")?;
// after
let org = "MyOrg".to_lowercase().replace(['.', ' '], "-");
let fqn = ProjectFqn::parse(&format!("{}/my-project", org))?; Defensive patterns
Strategy: validation
Validate before calling
fn valid_org_slug(org: &str) -> bool {
let mut chars = org.chars();
matches!(chars.next(), Some(c) if c.is_ascii_lowercase() || c.is_ascii_digit() || c == '_')
&& org.chars().all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || c == '_' || c == '-')
} Try / catch
match ProjectFqn::parse(input) { Ok(f) => f, Err(e) => { eprintln!("invalid FQN: {e}"); return Ok(()); } } Prevention
- Slugify org names (lowercase, replace invalid chars) before building FQNs
- Enforce org-name rules at signup/creation time, not parse time
- Document the slug charset in CLI help
When it happens
Trigger: Calling ProjectFqn::parse (or FromStr) with an FQN like "MyOrg/project" or "my.org/project" where the org segment fails the slug regex: must start with [a-z0-9_] and continue with [a-z0-9_-].
Common situations: Users typing org names with capitals or dots (GitHub-style org names) into CLI project creation; programmatic FQN construction from un-normalized org display names.
Understand the failure class
Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.
Related errors
- ' ' contains an
- call_id must be a nonzero uint64
- {0}
- -32602
- all ingress capacities and the response reservation must be…
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/4fbec8ea7d4bdbd5.
Report an issue: GitHub.
Appendix: source
Thrown at engine/bstd/src/project_fqn.rs:55
Self {
org_slug,
project_shortname: project_name,
}
}
pub fn parse(fqn: impl AsRef<str>) -> Result<Self> {
let fqn = fqn.as_ref();
let (org_slug, project_shortname) = fqn.split_once('/').context(format!(
"'{fqn}' is not a valid fully-qualified project name - must specify both an org and project name"
))?;
let org_slug = org_slug.to_string();
let project_shortname = project_shortname.to_string();
let org_slug_regex = Regex::new(r"^[a-z0-9_][a-z0-9_-]*$")
.context("Failed to construct org name validator")?;
if !org_slug_regex.is_match(&org_slug) {
anyhow::bail!("'{}' contains an invalid org name ('{}')", fqn, org_slug);
}
Self::is_valid_project_shortname(&project_shortname)
.map_err(|e| anyhow::anyhow!("'{}' contains an {e}", fqn))?;
Ok(Self {
org_slug,
project_shortname,
})
}
}
impl Display for ProjectFqn {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}/{}", self.org_slug, self.project_shortname)
}
}
#[cfg(test)]
mod tests {View on GitHub (pinned to bd85ce9dee)