You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Every failed instrument build reports an extra "Cannot read properties of undefined (reading 'inputs')" error from the bundler plugin #1800
Every failed instrument build reports one error too many. The extra error is the bundler crashing on itself: Cannot read properties of undefined (reading 'inputs'). The plugin's onEnd hook reads result.metafile!.inputs unconditionally, but esbuild does not produce a metafile when the build has errors. So the hook throws a TypeError, and esbuild appends it to BuildFailure.errors as a second error attributed to instrument-bundler-plugin. Any author with a syntax error or a missing file then sees "Build failed with 2 errors" and an internal TypeError alongside their real mistake. This appears in the playground's error fallback (its "Cause" section shows the esbuild message), in serve-instrument's log, and in the API's instrument repo import log.
Actual: the thrown error's cause.errors holds two messages: Expected identifier but found ";" and Cannot read properties of undefined (reading 'inputs') from instrument-bundler-plugin (verified on main). A missing import (import x from './nope.ts') also gets the same spurious second error.
Expected: cause.errors holds only the author's error.
Tests
packages/instrument-bundler/src/__tests__/build.test.ts: it('should report only the source error when compilation fails, so authors do not see an internal TypeError'). Run the real esbuild on a source with a syntax error and assert cause.errors has length 1.
e2e, in testing/src/specs/playground.spec.ts: introduce a syntax error in the editor and assert the error fallback does not contain reading 'inputs'.
Suggested fix
Return early from the onEnd callback when the build failed (if (!result.metafile) return;, or check result.errors.length).
Activity