Skip to content

Node stack parser splits anonymous frames at ( inside the file path (C:\Program Files (x86)\..., My App (beta)/...) #26202

Open

Description

@trackoor

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/node

SDK Version

11.11.0 (also develop 6c6c040)

Framework Version

Node.js v26.13.0

Link to Sentry event

No response

Reproduction Example/SDK Setup

/home/me/My App (beta)/index.js:

const { defaultStackParser } = require("@sentry/node");
try {
  [1].forEach(() => {
    throw new Error("boom");
  });
} catch (err) {
  console.log(err.stack.split("\n")[1]);
  const top = defaultStackParser(err.stack).pop();
  console.log(top.filename, "|", top.function, top.lineno, top.colno);
}

Steps to Reproduce

Run node index.js from a directory whose path contains a space followed by (. The same happens for any anonymous V8 frame such as at C:\Program Files (x86)\MyApp\index.js:2:9 or at async /home/me/My App (beta)/index.js:2:9.

Expected Result

    at /home/me/My App (beta)/index.js:4:11
/home/me/My App (beta)/index.js | ? 4 11

Actual Result

    at /home/me/My App (beta)/index.js:4:11
beta)/index.js | /home/me/My App 4 11

Parsing at C:\Program Files (x86)\MyApp\index.js:2:9 returns {"function":"C:\\Program Files","filename":"x86)\\MyApp\\index.js","in_app":false}. Named frames (at main (/home/me/My App (beta)/index.js:5:3)) are parsed as expected.

Additional Context

FULL_MATCH in packages/core/src/utils/node-stack-trace.ts is /at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/; the optional lazy (.+?)\s+\( function-name group matches up to the first ( in the path even when the line has no name ( prefix. The truncated filename no longer starts with / or a Windows drive letter, so filenameIsInApp also returns false, and source map lookup and code context fail for these frames. The browser chromeStackLineParser shows the same split for Node-style frames.

Priority

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

Credit: https://ucsbplse.github.io/

Activity

  1. linear-code commented on Nov 7, 2026

    @linear-code
  2. pcbeingused333 commented on Nov 7, 2026

    @pcbeingused333
    Contributor

    FULL_MATCH in packages/core/src/utils/node-stack-trace.ts takes a lazy optional function group, (?:(.+?)\s+\()?, so an anonymous Node frame whose path contains ( is split at the first parenthesis. On current develop (6c6c0402), at C:\Program Files (x86)\MyApp\index.js:2:9 comes out as function C:\Program Files and filename x86)\MyApp\index.js with in_app false, and at async /home/me/My App (beta)/index.js:4:11 splits the same way. Named frames that already wrap the path in parentheses parse correctly.

    The change I have in mind is one line: only take that function group when the frame actually ends with ) ((?=.*\)\s*$)). Anonymous frames then keep the full path and ? as the function, and the existing named, Object.<anonymous>, native, node:internal and eval at ... cases stay as they are. I would add the two anonymous cases above, plus a named frame with parentheses in the path, to the node block in stacktrace.test.ts.

    The browser chromeStackLineParser mentioned in the issue would stay out of this change unless you want it in the same PR. Happy to open the PR against develop if this is useful. OK to go ahead?

    (This comment was drafted with the help of an AI assistant, Claude.)

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions