BoundaryML/baml · error · VmBamlError
I/O error: {message}
Error message
I/O error: {message} What it means
An error value from the BAML standard library, mapping to the `baml.errors.Io` class. It represents a generic input/output failure from a stdlib operation that touches the outside world (files, streams, subprocess I/O, etc.), with the underlying reason in `message`.
Source
Thrown at baml_language/crates/bex_vm_types/src/errors.rs:119
/// echo).
#[error("host contract violation: {message} [class={class_name:?}, lang={language:?}]")]
HostContractViolation {
message: String,
class_name: Option<String>,
language: Option<String>,
},
}
/// An error value from the BAML standard library. Maps 1:1 to a `baml.errors.*` class.
#[derive(Debug, Error, PartialEq, Clone)]
pub enum VmBamlError {
#[error("invalid argument: {message}")]
InvalidArgument { message: String },
#[error("parse error: {message}")]
ParseError { message: String },
#[error("I/O error: {message}")]
Io { message: String },
#[error("timeout: {message}")]
Timeout {
message: String,
duration_ms: Option<i64>,
},
#[error("unsupported: {message}")]
Unsupported { message: String },
#[error("access error: {message}")]
AccessError { message: String },
#[error("render prompt: {message}")]
RenderPrompt { message: String },
#[error("LLM client error: {message}")]View on GitHub (pinned to bd85ce9dee)
Solutions
- Verify paths and that the resource exists/permissions allow access before the I/O call.
- Catch `baml.errors.Io` and surface a user-friendly message or fallback input source.
- Check the environment (working directory, mounts, file permissions) where the program runs.
- Inspect the wrapped `message` to identify the underlying OS error and address it directly.
Example fix
// before
let raw = fs.read("prompts/p.txt");
// after
let raw = if fs.exists("prompts/p.txt") {
fs.read("prompts/p.txt")
} else {
fs.read("prompts/default.txt")
};
Defensive patterns
Strategy: try-catch
Validate before calling
// BAML: check resource presence before I/O
if !fs.exists(path) {
return err("missing input file: " + path);
} Try / catch
try {
let raw = fs.read(path);
} catch e: baml.errors.Io {
return fallback_input() ?? rethrow_with_context(e.message);
} Prevention
- Resolve paths relative to known roots; verify in the deployment environment.
- Check file existence and permissions before I/O.
- Handle host I/O exceptions in host wrappers so they map to clean error messages.
- Test workflows in containers/environments mirroring production.
When it happens
Trigger: A stdlib I/O call fails at the OS/host level: missing file or directory, closed stream, device error, or a host-reported I/O exception propagated into the VM.
Common situations: Reading a prompt file that doesn't exist at the given path; running in a container where the working directory or mounted volume differs; a stream being closed by the other side mid-operation.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- no filesystem is attached to this server ({})
- disk error: {0}
- failed to read value segment {}: {error}
- profiling store contains a symlink
- profiling store contains an unsupported file type
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/d26536412dff1b9f.
Report an issue: GitHub.