Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
`SyntaxError` didn't report :line:offset for `Unexpected strict mode reserved word` | GoodFirstPicks

`SyntaxError` didn't report :line:offset for `Unexpected strict mode reserved word`

nodejs/node 2 comments 1mo ago
View on GitHub
mediumopenScope: somewhat clearSkill match: maybeNode.jsJavaScript

Why this is a good first issue

The issue involves improving syntax error reporting in ESM modules.

AI Summary

The issue reports a SyntaxError in ESM module loading that doesn't provide line/offset information. The problem is clear but requires understanding of Node.js's ESM implementation. The maintainer has requested a simpler repro case, which is a blocker for proceeding.

Issue Description

Version

v24.2.0

Platform

Linux fd829b446dea 6.6.96-0-virt #1-Alpine SMP PREEMPT_DYNAMIC 2025-07-07 15:18:25 aarch64 GNU/Linux

Subsystem

modules/esm/utils

What steps will reproduce the bug?

Create a file test/00.internal.Link.js with:

/* eslint-disable sort-keys */
import {describe, it} from "mocha";
import {expect} from "chai";
import isString from "is-string";
import Link, {BROKEN_REASON, EXCLUDED_REASON, HTML_ATTR_NAME, HTML_ATTRS, HTML_BASE_HREF, HTML_INDEX, HTML_LOCATION, HTML_OFFSET_INDEX, HTML_SELECTOR, HTML_TAG, HTML_TAG_NAME, HTML_TEXT, HTTP_RESPONSE, HTTP_RESPONSE_WAS_CACHED, IS_BROKEN, IS_INTERNAL, IS_SAME_PAGE, ORIGINAL_URL, REBASED_BASE_URL, REBASED_URL, REDIRECTED_URL, RESOLVED_BASE_URL, RESOLVED_URL, WAS_EXCLUDED} from "../lib/internal/Link.js";
import {simplifyLink} from "./helpers/index.js";
import URL_TESTS from "./fixtures-json/Link.json" with { type: "json" };


Before doing that, create it without with { type: "json" } to get:

 Exception during run: TypeError [ERR_IMPORT_ATTRIBUTE_MISSING]: Module "file:///broken-link-checker/test/fixtures-json/Link.json" needs an import attribute of "type: json"
    at validateAttributes (node:internal/modules/esm/assert:88:15)
    at defaultLoad (node:internal/modules/esm/load:129:3)
    at async ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:592:32) {
  code: 'ERR_IMPORT_ATTRIBUTE_MISSING'
}

But when adding with { type: "json" }, the result is:

 Exception during run: SyntaxError[ @/broken-link-checker/test/00.internal.Link.js ]: Unexpected strict mode reserved word
    at compileSourceTextModule (node:internal/modules/esm/utils:351:16)
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:107:18)
    at #translate (node:internal/modules/esm/loader:546:12)
    at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:593:27)

Note that in both cases, there is no line number/offset

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 10 points when you complete it!

Risk Flags

  • requires understanding of ESM module loading
  • syntax error reporting
Loading labels...

Details

Points10 pts
Difficultymedium
Scopesomewhat clear
Skill Matchmaybe
Test Focusedno