{"record":{"id":"28e0507d23f2ee34","repo":"BoundaryML/baml","slug":"no-markdown-blocks-found","errorCode":null,"errorMessage":"No markdown blocks found","messagePattern":"No markdown blocks found","errorType":"error_code","errorClass":"JsonishError","httpStatus":null,"severity":"error","filePath":"baml_language/crates/bex_sap/src/jsonish/mod.rs","lineNumber":19,"sourceCode":"//! This module implements parsing JSON-like data into a structured representation.\n//!\n//! The main entry point is the [`parse`] function, which takes a string and returns a [`Value`].\n//! This is basically the jsonish equivalent of [`serde_json::from_str`] and [`serde_json::Value`].\n\nmod parser;\nmod value;\n\npub use parser::{ParseOptions, parse};\npub use value::{CompletionState, Fixes, Value};\n\n/// Error type for jsonish parsing failures.\n#[derive(Debug, thiserror::Error)]\npub enum JsonishError {\n    #[error(\"Depth limit reached. Likely a circular reference.\")]\n    DepthLimitReached,\n    #[error(\"No JSON objects found\")]\n    NoJsonObjectsFound,\n    #[error(\"No markdown blocks found\")]\n    NoMarkdownBlocksFound,\n    #[error(\"Mismatched brackets\")]\n    MismatchedBrackets,\n    #[error(\"No collection to consume token: {0:?}\")]\n    NoCollectionForToken(char),\n    #[error(\"Failed to parse JSON\")]\n    ParseFailed,\n}\n","sourceCodeStart":1,"sourceCodeEnd":28,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/bex_sap/src/jsonish/mod.rs#L1-L28","documentation":"`JsonishError::NoMarkdownBlocksFound` is thrown when the parser is configured to (or attempts to) extract JSON from markdown code fences but no markdown blocks exist in the input. The jsonish parser supports pulling JSON out of fenced code blocks in LLM responses; with none present, this variant fires.","triggerScenarios":"Calling `bex_sap::jsonish::parse` on output that has no ```-fenced blocks when the extraction path expects one — e.g. the model emitted bare JSON or prose without wrapping it in a code fence.","commonSituations":"Model changed formatting behavior and stopped wrapping JSON in ```json fences; system prompt doesn't instruct fenced output; a model/provider update altered response formatting.","solutions":["Update the prompt to explicitly require wrapping JSON in a markdown code fence.","Confirm you actually need fence extraction; if the model emits bare JSON, the plain-JSON path should be used instead.","Strip or normalize the input before parsing to make fence extraction optional.","Check for provider/model version changes that altered output formatting."],"exampleFix":"// before\nlet v = jsonish::parse(response.text, &opts)?;\n// after\n// prompt change:\n// \"Return the JSON wrapped in a ```json code fence.\"\nlet v = jsonish::parse(&response.text, &opts)?;","handlingStrategy":"fallback","validationCode":"if needs_markdown_extraction && !raw.contains(\"```\") {\n    // fall back to plain-JSON extraction path instead\n}","typeGuard":null,"tryCatchPattern":"match jsonish::parse(&raw, &opts) {\n    Ok(v) => Ok(v),\n    Err(JsonishError::NoMarkdownBlocksFound) => jsonish::parse(&strip_fences(&raw), &opts),\n    Err(e) => Err(e.into()),\n}","preventionTips":["Require fenced code blocks in the prompt when relying on markdown extraction.","Make extraction mode explicit in ParseOptions rather than implicit.","Watch for provider/model updates that change response formatting."],"tags":["parsing","markdown","llm-output"],"backgroundTag":"json-parse-error","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}