Skip to content

[bug] 0.221.0+ tracing panic: Function log expected to be present (no FunctionStart event?) #3424

@artenc

Description

@artenc

Product

BAML

Describe the bug

Summary

After upgrading @boundaryml/baml from 0.220.0 to 0.221.0, our application crashes with a tracing/storage panic originating from the BAML runtime.

The issue persists in 0.222.0.

Downgrading back to 0.220.0 resolves the problem completely.

Error

thread '<unnamed>' (128394) panicked at baml-runtime/src/tracingv2/storage/storage.rs:546:22:
Function log expected to be present (no FunctionStart event?). Did you forget to track_function()?
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5, aborting
Aborted (core dumped)

Versions tested

  • @boundaryml/baml@0.220.0 — works
  • @boundaryml/baml@0.221.0 — crashes
  • @boundaryml/baml@0.222.0 — crashes

Expected behavior

BAML function calls should execute normally without runtime panics, and tracing/collector logs should be handled safely.

Actual behavior

The process aborts due to a Rust panic in:

baml-runtime/src/tracingv2/storage/storage.rs:546:22

The error indicates that a FunctionLog is being accessed without a corresponding FunctionStart event:

Function log expected to be present (no FunctionStart event?)

Additional context

  • We are using Collector / tracing functionality.
  • The issue appears to be a regression introduced in 0.221.0.
  • Likely related to tracing v2 lifecycle or event ordering/cleanup.

Environment

  • Node.js: v22.15.0
  • OS: Ubuntu 24.04.4 LTS
  • Package manager: npm 10.9.2
  • BAML package: @boundaryml/baml

Notes / Hypothesis

This may be caused by:

  • Missing or dropped FunctionStart events in tracing v2
  • Collector lifecycle or reference-counting issue
  • Race condition or cleanup happening before logs are accessed

Please let me know if you'd like additional debug output (RUST_BACKTRACE=1, BAML_LOG=debug) or a minimal repro.

Reproduction Steps

Consistently reproducible after upgrading from 0.220.00.221.0+.

If needed, I can attempt to provide a minimal reproduction case.

BAML Version

No response

Language/Framework

None

LLM Provider

None

LLM Model

No response

Operating System

None

Browser

None

Code Editor

None

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