Skip to content

b.parse intermittently returns empty list for valid JSON arrays of same-type union members #3307

@MauritsDescamps

Description

@MauritsDescamps

BAML version: 0.211.2
Language: Python (non-streaming b.parse)

Description

b.parse.MyFunction(text, {}) intermittently returns [] for valid JSON that matches the schema. The issue disproportionately affects arrays where the same union variant repeats (e.g., [Read, Read]), while single items and mixed-type arrays parse reliably.

This is non-streaming — we call b.parse on a complete LLM response string, not stream.getFinalResponse().

Is there any way to get more visibility into why the parsed response was empty?

I did notice that in one of the cases there as an imbalanced quote in the raw text blocks, but parsing locally worked fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions