{"record":{"id":"eb0f5d376b704aff","repo":"BoundaryML/baml","slug":"openai-transcriptions-do-not-support-reserved-request-field","errorCode":null,"errorMessage":"OpenAI transcriptions do not support reserved request field `{key}`","messagePattern":"OpenAI transcriptions do not support reserved request field `(.+?)`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/baml-runtime/src/internal/llm_client/primitive/openai/types.rs","lineNumber":155,"sourceCode":"            }\n        }\n        ChatMessagePart::Media(media) => {\n            if media.media_type != BamlMediaType::Audio {\n                bail!(\"OpenAI transcriptions only support audio media parts\")\n            }\n            audio_parts.push(media.clone());\n        }\n        ChatMessagePart::WithMeta(inner, _) => {\n            collect_transcription_prompt_parts(inner, audio_parts, text_parts)?;\n        }\n    }\n    Ok(())\n}\n\nfn reject_reserved_request_fields(properties: &BamlMap<String, Value>) -> Result<()> {\n    for key in [\"messages\", \"stream\"] {\n        if properties.contains_key(key) {\n            bail!(\"OpenAI transcriptions do not support reserved request field `{key}`\")\n        }\n    }\n    Ok(())\n}\n\nfn required_string_field(properties: &BamlMap<String, Value>, field: &str) -> Result<String> {\n    let value = properties\n        .get(field)\n        .with_context(|| format!(\"OpenAI transcriptions require string field `{field}`\"))?;\n\n    match value {\n        Value::String(value) => Ok(value.clone()),\n        _ => bail!(\"OpenAI transcription field `{field}` must be a string\"),\n    }\n}\n\nfn optional_string_field(\n    properties: &BamlMap<String, Value>,","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-runtime/src/internal/llm_client/primitive/openai/types.rs#L137-L173","documentation":"OpenAI transcription requests get their body from the collected parts (audio bytes, model, prompt), so BAML reserves the `messages` and `stream` request fields — letting users override them would corrupt or conflict with the constructed multipart body. reject_reserved_request_fields bails if either key appears in the client properties.","triggerScenarios":"Setting `messages` or `stream` in the options block of a transcription-configured OpenAI client (copied from a chat client config), which is checked at the start of build_transcription_parts.","commonSituations":"Copying a chat-completions client block and changing only the model to whisper-1, leaving `stream true` or a `messages` override in place; adding passthrough options wholesale from another client.","solutions":["Remove `messages` and `stream` keys from the transcription client's options.","Keep transcription client options limited to transcription-relevant fields (model, prompt, language, temperature, etc.).","If you need streaming chat, use a separate chat client rather than the transcription client."],"exampleFix":"// before\nclient<Transcribe> { provider openai options { model \"whisper-1\" stream true } }\n// after\nclient<Transcribe> { provider openai options { model \"whisper-1\" } }","handlingStrategy":"validation","validationCode":"// Reject reserved fields in transcription client options before use\nconst RESERVED = [\"messages\", \"stream\"];\nfor (const key of RESERVED) {\n  if (key in clientOptions) throw new Error(`Remove reserved field '${key}' from transcription options`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never copy chat-client options (messages/stream) into transcription client blocks.","Keep transcription options to: model, prompt, language, temperature, response_format.","Lint clients.baml for reserved keys in clients whose model is a transcription model."],"tags":["openai","transcription","config","reserved-fields","baml"],"backgroundTag":"conflicting-config-options","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}