https://www.boundaryml.com logo
Error: BamlError: This should never happen - Pleas...
# help
i
at /node_modules/.pnpm/@boundaryml+baml@0.214.0/node_modules/@boundaryml/baml/stream.js:91:27) code: 'GenericFailure'
I activate BAML_LOG=info, but i don't see what the error is
Copy code
---LLM REPLY---
    I'll help you check the talent pool size for Backend Developers across different US cities. Let me start with some major tech hubs:
    
    [
      {
        "type": "tool_use",
        "id": "pool_check_1",
        "name": "get_pool_size",
        "input": {
          "tool_name": "get_pool_size",
          "job_title": "Backend Developer",
          "locations": [{"location_query": "San Francisco", "radius_in_miles": 25}],
          "reason": "Checking pool size for Backend Developer in San Francisco"
        }
      }
    ]
Error: BamlError: This should never happen - Please report this error to our team with BAML_LOG=info enabled so we can improve this error message
    at [Symbol.asyncIterator] (/Users/idanrokach/code/perfect/perfect-monorepo/node_modules/.pnpm/@boundaryml+baml@0.214.0/node_modules/@boundaryml/baml/stream.js:91:27)
    at async AgentRuntimeService.executeStreamingLoop (/Users/idanrokach/code/perfect/perfect-monorepo/apps/perfect-agent-service/src/modules/agent/services/agent-runtime.service.ts:284:21) {
  code: 'GenericFailure'
}
Baml
Copy code
class AssistantMessage {
  role "assistant" @stream.not_null
  content TextBlock | ToolUseBlock[]
}
function MatchSearchAgent(conversation_history: Message[], current_search_params: SearchParams?) -> AssistantMessage
Generated type:
Copy code
role: "assistant"
  content: TextBlock | ToolUseBlock[]
  
}
a
Does it always error?
i
It always happens when i prompt the agent to return multiple tool_use of
get_pool_size
For example: "Look for talent pool sizes for Backend developer at each one of the following: New York, San Francisco, Denver, Austin, Boston"
This continues to happen.. I think it's something related to the streaming where you try to pause a chunk, and the LLM returns something that is currently not possible. Then you throw the error, but since you return this will never happen, there is not much information about what's happening.
@aaronv (BAML) @Vaibhav (BAML 🐑)
We are going prod Thursday and honestly i would like to avoid replacing baml at any cost right now since it will take time
v
Thanks for the context. Can you perhaps dm us that function / code and we’ll try and repro it
Once we do that we can patch and make a release same day!
i
Sure
a
@IdanR I'm taking a look now to see if I can reproduce
i
@aaronv (BAML) thanks! Let me know if i can help
a
i will l ikely need the full BAML schema if you have it, since the contents of TextBlock or ToolUseBlock may matter
ping me when you have that and i'll get right on it!
i
oh shoot haven't seen ur message
a
yeah ideally the most complete example would be great
cause i want to release ASAP and maybe i can patch this real quick
i
You need also the function with the templates?
a
x86-alpine*
we did fix the x86 musl issue (at least from my test)
Great to hear! thanks for working hard
tell me if its available
a
yep i got it
i
cool
I'll pull out a conversation of which it occured
a
do you know if this reproduces in the playground? or have you only seen this in your node code
i
unfortunately only in node code, during in streaming
btw as you can see I changed a little the AssistantMessage from the original message i posted here. The original message here is the way i would want it to work. But the current version is encountering this issue less. but requires me to instruct the llm more strictly to not return text along with ToolUseBlock. Anyway this is conversation that fails few times today with Claude 4. (This was tested with the current files I sent you) (We upgraded to Claude 4-5, it helped but still got the same error) https://cdn.discordapp.com/attachments/1453766528854917205/1455669797588176896/message.txt?ex=695591a4&is=69544024&hm=c5209e9b051e9abe07999cb059d745356feeb3e1fa125063df8b048ddbcf701b&
a
do you use our observability platform?
studio.boundaryml.com
im trying to repro
i
no I don't.. I'll try add it tomorrow I guess. Does the pricing comes with special support for business other than discord channel?
a
it is free for now, since it's early beta, and we will nuke our database at some point soon
but no tehre is no special support. If you do want a slack channel i can set one up though
for no cost
i
sure that will be really helpful
a
you can add your DM your email and i can send you an invite
so I added you to slack, but it would be good to have logs from studio.boundaryml.com if you are able to repro on your app and grab the event from there, even if you run it locally and it errors out
i haven't been able to reproduce the parsing issue yet
im trying something like:
Copy code
function MatchSearchAgent(conversation_history: Message[], current_search_params: SearchParams?) -> AssistantMessage {
  client CustomSonnet
  prompt #"
    return this exact string with the modification in the comment:
     I'll help you check the talent pool size for Backend Developers across different US cities. Let me start with some major tech hubs:
    
    [
    // return two of these, make th e othe rone pool_check_2
     {
      "role": "assistant",
      "content": [
      {
        "type": "tool_use",
        "id": "pool_check_1",
        "name": "get_pool_size",
        "input": {
          "tool_name": "get_pool_size",
          "job_title": "Backend Developer",
          "locations": [{"location_query": "San Francisco", "radius_in_miles": 25}],
          "reason": "Checking pool size for Backend Developer in San Francisco"
        }
      }
      ]
    }
    ]

  "#
}