Skip to content

Parse and transform errors do not include the line and column #839

Closed

Description

@fengmk2

A syntax error reports only the message, with no line, column, or code frame:

$ cat main.ts
const ok = 1;
console.log(ok);
const broken: number = ;

$ node --import @oxc-node/core/register main.ts
Error: Failed to parse file:///…/main.ts: Unexpected token
$ tsx main.ts
Error: Transform failed with 1 error:
/…/main.ts:3:23: ERROR: Unexpected ";"

In a large file the message gives no way to find the error. Transform errors (Failed to transform …) have the same problem. Reproduced with @oxc-node/core@0.1.7 from npm on macOS arm64 with Node.js 24.12, and on 22.18 and 26.5 through an embedder that compiles in v0.1.7.

Cause

join_errors (src/lib.rs#L2282-L2288) attaches the source with with_source_code, then formats each diagnostic with to_string(), which prints only the message and drops the labeled span. Both Failed to parse (#L1079-L1083) and Failed to transform (#L1270-L1275) use it.

Suggested fix

Render each diagnostic with its location: at least path:line:column, or a colorless graphical report with the offending line, as esbuild, tsc, and Node.js type stripping show.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions