Skip to content

Line parsing breaks with [object Object] #13

Closed

Description

@jylauril

For some reason on node side I managed to get following type of stack trace:

Error: Could not do something
  at [object Object].foo.bar (foo.js:1:2)

Which gets parsed into

[{
  fileName: 'Object].foo.bar (foo.js',
  lineNumber: 1,
  functionName: '[object',
  typeName: 'Object',
  methodName: null,
  columnNumber: 2,
  native: false
}]

Problem seems to be with the regexp on this line:
https://github.com/felixge/node-stack-trace/blob/master/lib/stack-trace.js#L42

Might need to do some more advanced regexp magic, or just parse the line differently.. any thoughts?

Activity

  1. niemyjski commented on Apr 24, 2026

    @niemyjski
    Collaborator

    Hi @jylauril 👋

    Thanks for the detailed report and analysis. You're right — the regex breaks when the function name contains [object Object] because the brackets and spaces confuse the capture groups.

    This is a legitimate parsing bug. A PR to fix the regex to handle bracketed function names would be very welcome!

  2. added 3 commits that reference this issue on May 2, 2026
  3. self-assigned this
    on May 2, 2026
  4. added a commit that references this issue on May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions