BoundaryML/baml · error · LogError
Configuration error: {0}
Error message
Configuration error: {0} What it means
This is the `LogError::Config(String)` variant of BAML's logging `LogError` enum in baml-log. It signals that an operation on the logger failed because of a problem with the logger's configuration payload (an invalid or inconsistent LogConfig value passed to logging setup or emission code). The String payload carries the specific configuration problem reported by the caller.
Source
Thrown at engine/baml-lib/baml-log/src/logger.rs:423
}
/// Error type for logging operations
#[derive(Debug, Error)]
pub enum LogError {
/// Error writing to output
#[error("IO error: {0}")]
Io(#[from] io::Error),
/// Error serializing to JSON
#[error("JSON serialization error: {0}")]
Json(#[from] serde_json::Error),
/// Error acquiring lock
#[error("Failed to acquire lock")]
LockError,
/// Configuration error
#[error("Configuration error: {0}")]
Config(String),
}
// /// JSON-serializable log entry
// #[derive(Serialize)]
// struct LogEntry<'a> {
// /// Timestamp in ISO 8601 format
// timestamp: String,
// /// Log level as a string
// level: &'a str,
// /// Log message
// message: String,
// /// Optional module path
// #[serde(skip_serializing_if = "Option::is_none")]
// module_path: Option<&'a str>,
// /// Optional file name
// #[serde(skip_serializing_if = "Option::is_none")]
// file: Option<&'a str>,View on GitHub (pinned to bd85ce9dee)
Solutions
- Read the embedded String message — it names the exact config field/value that was rejected; fix that value.
- Validate the log configuration (level string, file path) before passing it to the logger API.
- Check environment variables feeding LogConfig::from_env for typos or unsupported values and correct them.
- If reconfiguring at runtime, ensure the new LogConfig is fully constructed via its builder/constructor rather than patched field-by-field.
Example fix
// before
let cfg = LogConfig { level: "verrbose".into(), ..Default::default() };
logger.set_config(cfg)?; // Configuration error: invalid log level 'verrbose'
// after
let cfg = LogConfig { level: "verbose".into(), ..Default::default() };
debug_assert!(cfg.level.is_valid());
logger.set_config(cfg)?; Defensive patterns
Strategy: validation
Validate before calling
// Rust: validate log config before handing it to the logger
fn validate_log_config(level: &str, file: Option<&Path>) -> Result<(), String> {
match level.to_ascii_lowercase().as_str() {
"trace" | "debug" | "info" | "warn" | "error" => {}
other => return Err(format!("invalid log level: {other}")),
}
if let Some(p) = file {
if !p.as_os_str().is_empty() {
return Err("log file path configured but empty".into());
}
}
Ok(())
} Prevention
- Validate log level strings and file paths before constructing LogConfig
- Prefer LogConfig's own constructors/builders over hand-built structs
- Check BAML log-related env vars in deployment configs during CI
- When mutating logger config at runtime, construct a complete new LogConfig rather than patching fields
When it happens
Trigger: Constructing or mutating the global LogConfig (held behind a lazy_static RwLock) with invalid values — e.g. an unparsable log level, an invalid log-file path configuration, or calling a logger API with a config object whose fields are inconsistent (format set but file path missing). The error surfaces wherever code returns LogError::Config(msg) from config-handling paths in logger.rs.
Common situations: Setting BAML log-related environment variables to invalid values that LogConfig::from_env or a runtime setter consumes; programmatically reconfiguring the logger at runtime (the 'runtime modification support' on CONFIG) with a bad value; wiring a custom log sink/file path that config validation rejects.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- {0}
- Playground server requires either BAML_PLAYGROUND_DEV_PORT o
- Invalid BAML_PLAYGROUND_DEV_PORT: {e}
- interned member `{name}` cannot be another member's child
- the master member cannot be interned: the master is the plai
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/0960047f7f37275a.
Report an issue: GitHub.