Skip to content

Commit e4230d1

Browse files
committed
fix(config): handle known Node.js bug in nativeImport error handling
closes #766
1 parent 7fb7286 commit e4230d1

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/config/file.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,20 @@ async function nativeImport(id: string) {
202202
{ cause: error },
203203
)
204204
throw configError
205-
} else {
206-
throw error
207205
}
206+
207+
const nodeInternalBug =
208+
typeof error?.stack === 'string' &&
209+
error.stack.includes('node:internal/modules/esm/translators')
210+
if (nodeInternalBug) {
211+
const configError = new Error(
212+
`Failed to load the config file due to a known Node.js bug. Try setting the --config-loader CLI flag to \`unrun\` or upgrading Node.js to v24.11.1 or later.\n\n${error.message}`,
213+
{ cause: error },
214+
)
215+
throw configError
216+
}
217+
218+
throw error
208219
})
209220
const config = mod.default || mod
210221
return config

0 commit comments

Comments
 (0)