Skip to content

Bun runtime: source-map crash during indexing (Column must be >= 0, got -1) #3045

Description

@capaj

Description

When using runtime: 'bun' in trigger.config.ts, the indexing phase crashes with:

TypeError: Column must be greater than or equal to 0, got -1
    at SourceMapConsumer_findMapping (source-map/lib/source-map-consumer.js:588:13)
    at SourceMapConsumer_originalPositionFor (source-map/lib/source-map-consumer.js:653:17)
    at mapSourcePosition (source-map-support/source-map-support.js:244:38)
    at wrapCallSite (source-map-support/source-map-support.js:397:9)
    at prepareStackTrace (source-map-support/source-map-support.js:446:25)
    at registerResources (trigger.dev/src/indexing/registerResources.ts:32:11)
    at bootstrap (trigger.dev/src/entryPoints/managed-index-worker.ts:91:37)

This happens because Bun's runtime produces -1 as a column value when resolving stack traces, and source-map@0.6.1 (transitive dep via source-map-support@0.5.21) throws on negative columns.

This is a known Bun issue: oven-sh/bun#8087

Reproduction

  • trigger.dev v4.3.3
  • runtime: 'bun' in trigger.config.ts
  • A monorepo project with shared modules imported across packages

The error started appearing after a refactoring that introduced new cross-package imports, likely producing source maps that trigger the Bun bug.

Workaround

We patched source-map@0.6.1 via pnpm to clamp -1 columns to 0 instead of throwing:

-      throw new TypeError('Column must be greater than or equal to 0, got '
-                          + aNeedle[aColumnName]);
+      aNeedle[aColumnName] = 0;

Suggested fix

Since bun runtime is already marked as experimental, trigger.dev could either:

  1. Catch and gracefully handle this error in registerResources during indexing
  2. Pin or patch source-map-support to handle invalid column values
  3. Document this as a known bun runtime limitation

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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