You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ERR_MODULE_NOT_FOUND in 0.1.31: session.js missing .js extension on vscode-jsonrpc/node import #707
@github/copilot-sdk@0.1.31 crashes on startup under Node.js v24 due to a missing .js file extension on a new import added to dist/session.js.
Same class of defect as #8 (fixed in 0.1.10/0.1.11 for client.js).
Error
Error [ERR_MODULE_NOT_FOUND]: Cannot find module
'.../node_modules/vscode-jsonrpc/node'
imported from .../node_modules/@github/copilot-sdk/dist/session.js
Did you mean to import "vscode-jsonrpc/node.js"?
Root Cause
SDK 0.1.31 added a new import to dist/session.js (not present in 0.1.29) that omits the .js extension:
# 0.1.31 session.js line 1 -- NEW import, missing .js
import { ConnectionError, ResponseError } from "vscode-jsonrpc/node";
# 0.1.31 client.js line 10 -- existing import, correct
} from "vscode-jsonrpc/node.js";
The SDK declares "type": "module" (ESM). The dependency vscode-jsonrpc@8.2.1 has no exports map and no "type" field. Without an exports map, Node ESM resolution does not auto-append .js for subpath imports, so "vscode-jsonrpc/node" fails to resolve even though node.js exists in the package root.
dist/client.js already uses the correct "vscode-jsonrpc/node.js" form -- the new session.js import simply did not follow the same convention.
Diff: 0.1.29 / 0.1.30 vs 0.1.31
File
0.1.29
0.1.30
0.1.31
dist/session.js
No vscode-jsonrpc import
No vscode-jsonrpc import
import { ConnectionError, ResponseError } from "vscode-jsonrpc/node" (missing .js)
dist/client.js
from "vscode-jsonrpc/node.js"
from "vscode-jsonrpc/node.js"
from "vscode-jsonrpc/node.js" (unchanged, correct)
Environment
Affected: 0.1.31
Working: 0.1.29, 0.1.30
Node.js: v24.14.0
OS: Linux
Workaround
Pin to 0.1.30 (or 0.1.29):
"@github/copilot-sdk": "0.1.30"
Suggested Fix
Add .js to the import in the source that produces dist/session.js:
I also ran into this in our test suite (vitest with Node ESM). There's another workaround which involves registering a custom module resolution hook before the SDK gets imported:
For vitest, you can drop this in a file and add it to the setupFiles in your config. For plain Node, you can pass it with --import ./fix-jsonrpc-import.js. The hook will intercept the bare vscode-jsonrpc/node specifier and appends .js before Node's default resolver sees it.
It's worth noting that this only affects ESM contexts where Node enforces strict specifier resolution. CJS works fine and so do bundlers like tsx, since they handle extension-less imports on their own.
Still present in v0.1.32, also reproducible on Node 22
Confirming this bug is not fixed in v0.1.32 (latest as of 2026-03-14). The bad import is unchanged in the published package:
$ npm show @github/copilot-sdk version
0.1.32
$ node -e "require('fs').readFileSync(require.resolve('@github/copilot-sdk/dist/session.js'), 'utf8').split('\n').slice(0,1).forEach(l => console.log(l))"
import { ConnectionError, ResponseError } from "vscode-jsonrpc/node";
Additional environment data
Field
Value
@github/copilot-sdk
0.1.32
vscode-jsonrpc
8.2.1
Node.js
v22.22.0 (also fails on v22, not just v24)
OS
Linux (WSL2)
The error is identical to what #707 describes — Node 22's strict ESM resolver also refuses to auto-append .js for subpath imports on packages without an exports map.
Workaround for npm-installed packages
As an alternative to the module hook in the previous comment, a postinstall script can patch the file in place (no runtime overhead):
// postinstall patch (CJS, no deps required)constfs=require('fs'),path=require('path');constf=path.resolve(process.cwd(),'node_modules/@github/copilot-sdk/dist/session.js');try{consts=fs.readFileSync(f,'utf8');fs.writeFileSync(f,s.replace('from "vscode-jsonrpc/node"','from "vscode-jsonrpc/node.js"'));}catch(_){}
This is idempotent and non-fatal if the file is absent. Hoping for an official fix in 0.1.33+.
Activity
theblixguy commentedon Mar 7, 2026
I also ran into this in our test suite (
vitestwith Node ESM). There's another workaround which involves registering a custom module resolution hook before the SDK gets imported:For
vitest, you can drop this in a file and add it to thesetupFilesin your config. For plain Node, you can pass it with--import ./fix-jsonrpc-import.js. The hook will intercept the barevscode-jsonrpc/nodespecifier and appends.jsbefore Node's default resolver sees it.It's worth noting that this only affects ESM contexts where Node enforces strict specifier resolution. CJS works fine and so do bundlers like
tsx, since they handle extension-less imports on their own.fix(nodejs): add .js extension to vscode-jsonrpc/node import in sessi…
fix(nodejs): add .js extension to vscode-jsonrpc/node import in sessi…
Rubiss commentedon Mar 14, 2026
Still present in v0.1.32, also reproducible on Node 22
Confirming this bug is not fixed in v0.1.32 (latest as of 2026-03-14). The bad import is unchanged in the published package:
Additional environment data
@github/copilot-sdkvscode-jsonrpcThe error is identical to what #707 describes — Node 22's strict ESM resolver also refuses to auto-append
.jsfor subpath imports on packages without anexportsmap.Workaround for npm-installed packages
As an alternative to the module hook in the previous comment, a
postinstallscript can patch the file in place (no runtime overhead):This is idempotent and non-fatal if the file is absent. Hoping for an official fix in 0.1.33+.
norrisp90 commentedon Mar 14, 2026
Confirming on Node 22 with
@github/copilot-sdk@0.1.32+vscode-jsonrpc@8.2.1in a CommonJS Express server that dynamic-imports the SDK.We settled on
patch-packageas the workaround — it's the lightest touch and works cleanly in Docker builds:No runtime hooks, no version overrides, auto-applies on
npm install, and self-removes when the SDK ships the fix.theblixguy commentedon Mar 14, 2026
It's fixed on main but I think they haven't shipped a new release since then, so we need to wait for .33
sinedied commentedon Mar 19, 2026
Bumping this, the issue is already fixed so would it be possible to publish a new version? This is currently blocking
patniko commentedon Mar 19, 2026
Coming. We are combining a few breaking changes and releases for integrators at the moment. Expect a rev to 0.2.xx within the next day.
SteveSandersonMS commentedon Mar 19, 2026
Yohan Lasorsa (@sinedied) Just shipped 0.1.33-preview.3 to NPM - please let us know if you still run into this issue.
sinedied commentedon Mar 20, 2026
Steve Sanderson (@SteveSandersonMS) updated, tested it fixed the issue thanks!
fix(cli): update Copilot SDK to fix module loading error (#190)