BoundaryML/baml · warning
No markdown blocks found
Error message
No markdown blocks found
What it means
The markdown parser scans the input for fenced code blocks (``` or ~~~ style) and returns 'No markdown blocks found' when none were detected. It exists so JSON can be extracted from ```json fences; no fences means this parser has nothing to return.
Source
Thrown at engine/baml-lib/jsonish/src/jsonish/parser/markdown_parser.rs:128
"<unspecified>"
}
}
.to_string(),
v,
));
}
Err(e) => {
log::debug!("Error parsing markdown block: Tag: {tag}\n{e:?}");
}
};
if !should_loop {
break;
}
}
if values.is_empty() {
anyhow::bail!("No markdown blocks found")
} else {
if !remaining.trim().is_empty() {
values.push(MarkdownResult::String(remaining.to_string()));
}
Ok(values)
}
}
#[cfg(test)]
mod test {
use baml_types::CompletionState;
use test_log::test;
use super::*;
use crate::jsonish::Value;
#[test]
fn basic_parse() -> Result<()> {View on GitHub (pinned to bd85ce9dee)
Solutions
- Don't force the markdown parser for unfenced content — let the plain JSON parser handle it
- Check whether the model wrapped output in a non-standard fence and normalize it (e.g. convert ~~~ to ```)
- Update the prompt to require ```json fenced output
- Catch the error and retry with a stricter formatting instruction
Example fix
// before
let blocks = markdown_parser::parse(text).expect("fences");
// after
let blocks = match markdown_parser::parse(text) {
Ok(b) => b,
Err(_) => vec![MarkdownResult::String(text.to_string())],
}; Defensive patterns
Strategy: fallback
Validate before calling
fn has_fence(s: &str) -> bool { s.contains("```") || s.contains("~~~") } Try / catch
match markdown_parser::parse(text) {
Err(_) | Ok(ref b) if b.is_empty() => vec![MarkdownResult::String(text.to_string())],
Ok(b) => b,
} Prevention
- Prompt the model to wrap output in ```json fences
- Normalize non-standard fences (~~~ -> ```) before parsing
- Route unfenced JSON to the plain JSON parser instead
When it happens
Trigger: Calling markdown_parser::parse (or the jsonish pipeline routing to it) on text with zero fence-like code blocks, e.g. raw JSON without backticks or plain prose.
Common situations: Prompt asked the model for code blocks but the model returned bare JSON or plain text; model used a single backtick or indented code without fences.
Understand the failure class
Background: JSON parse error: "Unexpected token" / "not valid JSON" / "failed to parse" — what JSON parsers are really complaining about — this error's family across 45 libraries.
Related errors
- No markdown blocks found
- No JSON objects found
- Failed to parse JSON
- Failed to parse JSON
- Failed to parse function result: {}
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/9604d4aee871ca40.
Report an issue: GitHub.