yunabe / tslab

Interactive JavaScript and TypeScript programming with Jupyter
Apache License 2.0
700 stars 44 forks source link

`Error: Unexpected pending rebuildTimer` error #97

Open bracesproul opened 4 months ago

bracesproul commented 4 months ago

Getting this error when trying to run pretty standard code inside a notebook:

unexpected error: Error: Unexpected pending rebuildTimer
    at sys.setTimeout (/Users/bracesproul/.npm-global/lib/node_modules/tslab/dist/converter.js:111:19)
    at scheduleProgramUpdate (/Users/bracesproul/.npm-global/lib/node_modules/tslab/node_modules/@tslab/typescript-for-tslab/lib/typescript.js:122735:35)
    at onSourceFileChange (/Users/bracesproul/.npm-global/lib/node_modules/tslab/node_modules/@tslab/typescript-for-tslab/lib/typescript.js:122876:7)
    at [/Users/bracesproul/.npm-global/lib/node_modules/tslab/node_modules/](https://file+.vscode-resource.vscode-cdn.net/Users/bracesproul/.npm-global/lib/node_modules/tslab/node_modules/)@tslab/typescript-for-tslab/lib/typescript.js:122868:56
    at updateContent (/Users/bracesproul/.npm-global/lib/node_modules/tslab/dist/converter.js:601:9)
    at Object.convert (/Users/bracesproul/.npm-global/lib/node_modules/tslab/dist/converter.js:252:9)
    at Object.execute (/Users/bracesproul/.npm-global/lib/node_modules/tslab/dist/executor.js:138:38)
    at JupyterHandlerImpl.handleExecuteImpl (/Users/bracesproul/.npm-global/lib/node_modules/tslab/dist/jupyter.js:223:38)
    at [/Users/bracesproul/.npm-global/lib/node_modules/tslab/dist/jupyter.js:181:57](https://file+.vscode-resource.vscode-cdn.net/Users/bracesproul/.npm-global/lib/node_modules/tslab/dist/jupyter.js:181:57)
    at async JupyterHandlerImpl.handleExecute (/Users/bracesproul/.npm-global/lib/node_modules/tslab/dist/jupyter.js:181:21)

Kernel: TypeScript Here are the cells & TS code:

import { UnstructuredLoader } from "@langchain/community/document_loaders/fs/unstructured";

const markdownPath = "../../../../README.md";

const loader = new UnstructuredLoader(markdownPath, {
  apiKey: process.env.UNSTRUCTURED_API_KEY,
  apiUrl: process.env.UNSTRUCTURED_API_URL,
});

const data = await loader.load()
console.log(data);
const loader = new UnstructuredLoader(markdownPath, {
    chunkingStrategy: "by_title"
});

const data = await loader.load()

console.log(`Number of documents: ${data.length}\n`)

for (const doc of data.slice(0, 2)) {
    console.log(doc);
    console.log("\n");
}
const categories = new Set(data.map((document) => document.metadata.category));
console.log(categories);
khanguslee commented 2 months ago

Somehow did not get this error again once I restarted via jupyter lab.