#2845·CopilotKit

Bug: Attempted import error: 'CancellationToken' is not exported from '../utils/cancellation.js' (imported as 'CancellationToken').

Author: ben-gineerCreated Dec 13, 2025Updated Sep 28, 2026
Labelsbug

♻️ Reproduction Steps

  "dependencies": {
    "@ag-ui/client": "^0.0.42",
    "@copilotkit/react-core": "^1.50.0",
    "@copilotkit/react-ui": "^1.50.0",
    "@copilotkit/runtime": "^1.50.0",
    "@emotion/react": "^11.14.0",
    "@emotion/styled": "^11.14.1",
    "@mui/icons-material": "^7.3.6",
    "@mui/material": "^7.3.6",
    "@mui/material-nextjs": "^7.3.6",
    "@xyflow/react": "^12.10.0",
    "html-to-image": "^1.11.13",
    "next": "^16.0.10",
    "react": "^19.2.3",
    "react-dom": "^19.2.3",
    "react-icons": "^5.5.0",
    "react-markdown": "^10.1.0",
    "remark-gfm": "^4.0.1",
    "zod": "^4.1.13"
  },
  1. Run with Turbopack:
bash
next dev --turbopack
../../node_modules/.pnpm/[email protected]/node_modules/langium/lib/references/scope-computation.js
Attempted import error: 'CancellationToken' is not exported from '../utils/cancellation.js' (imported as 'CancellationToken').

Import trace for requested module:
../../node_modules/.pnpm/[email protected]/node_modules/langium/lib/references/scope-computation.js
../../node_modules/.pnpm/[email protected]/node_modules/langium/lib/default-module.js
../../node_modules/.pnpm/[email protected]/node_modules/langium/lib/index.js
../../node_modules/.pnpm/@[email protected]/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-S6J4BHB3.mjs
../../node_modules/.pnpm/@[email protected]/node_modules/@mermaid-js/parser/dist/mermaid-parser.core.mjs
../../node_modules/.pnpm/[email protected]/node_modules/mermaid/dist/chunks/mermaid.core/diagram-PSM6KHXK.mjs
../../node_modules/.pnpm/[email protected]/node_modules/mermaid/dist/mermaid.core.mjs
../../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/streamdown/dist/chunk-OGVTOU66.js
../../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/streamdown/dist/index.js
../../node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@types+react@19_7ea1dec8b20d774b47c192daf92bbc7b/node_modules/@copilotkitnext/react/dist/index.mjs
../../node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@types+react@1_fdd8c80c34e7d1be075c2b72e241e734/node_modules/@copilotkit/react-core/dist/chunk-XDFVCQD3.mjs
../../node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@types+react@1_fdd8c80c34e7d1be075c2b72e241e734/node_modules/@copilotkit/react-core/dist/index.mjs
./src/app/layout.tsx
javascript
export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  return (
    <html lang="en">
      <body>
        <ThemeProvider theme={defaultTheme}>
          <CssBaseline />
          <CopilotKit runtimeUrl="/api/copilotkit" agent="ResearchAgent">
            {children}
          </CopilotKit>
        </ThemeProvider>
      </body>
    </html>
  );
}

It looks similar to:

https://github.com/vercel/streamdown/issues/182 and https://github.com/mermaid-js/mermaid/issues/7094

I've tried the workarounds, and neither work

✅ Expected Behavior

It builds

❌ Actual Behavior

It errors:

../../node_modules/.pnpm/[email protected]/node_modules/langium/lib/references/scope-computation.js
Attempted import error: 'CancellationToken' is not exported from '../utils/cancellation.js' (imported as 'CancellationToken').

Import trace for requested module:
../../node_modules/.pnpm/[email protected]/node_modules/langium/lib/references/scope-computation.js
../../node_modules/.pnpm/[email protected]/node_modules/langium/lib/default-module.js
../../node_modules/.pnpm/[email protected]/node_modules/langium/lib/index.js
../../node_modules/.pnpm/@[email protected]/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-S6J4BHB3.mjs
../../node_modules/.pnpm/@[email protected]/node_modules/@mermaid-js/parser/dist/mermaid-parser.core.mjs
../../node_modules/.pnpm/[email protected]/node_modules/mermaid/dist/chunks/mermaid.core/diagram-PSM6KHXK.mjs
../../node_modules/.pnpm/[email protected]/node_modules/mermaid/dist/mermaid.core.mjs
../../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/streamdown/dist/chunk-OGVTOU66.js
../../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/streamdown/dist/index.js
../../node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@types+react@19_7ea1dec8b20d774b47c192daf92bbc7b/node_modules/@copilotkitnext/react/dist/index.mjs
../../node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@types+react@1_fdd8c80c34e7d1be075c2b72e241e734/node_modules/@copilotkit/react-core/dist/chunk-XDFVCQD3.mjs
../../node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@types+react@1_fdd8c80c34e7d1be075c2b72e241e734/node_modules/@copilotkit/react-core/dist/index.mjs

CopilotKit Version

bash
├── @copilotkit/[email protected] -> ./../../node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@types+react@1_fdd8c80c34e7d1be075c2b72e241e734/node_modules/@copilotkit/react-core
├── @copilotkit/[email protected] -> ./../../node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@types+react@19._61ef9d83140bd6d1bfbcee112024010f/node_modules/@copilotkit/react-ui
├── @copilotkit/[email protected] -> ./../../node_modules/.pnpm/@[email protected]_018e373dc2c8d60e9a304e9b5edef133/node_modules/@copilotkit/runtime

Logs (Optional)

bash