{"record":{"id":"e0d0d278ca8194e1","repo":"FlowiseAI/Flowise","slug":"failed-to-load-fs-promises-make-sure-you-are-runn-e0d0d2","errorCode":null,"errorMessage":"Failed to load fs/promises. Make sure you are running in Node.js environment.","messagePattern":"Failed to load fs/promises\\. Make sure you are running in Node\\.js environment\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/documentloaders/Jsonlines/Jsonlines.ts","lineNumber":290,"sourceCode":"                        ? { ...metadata, ...additionalMetadata }\n                        : {\n                              ...metadata,\n                              line: i + 1,\n                              ...additionalMetadata\n                          }\n            })\n        })\n    }\n\n    static async imports(): Promise<{\n        readFile: typeof ReadFileT\n    }> {\n        try {\n            const { readFile } = await import('node:fs/promises')\n            return { readFile }\n        } catch (e) {\n            console.error(e)\n            throw new Error(`Failed to load fs/promises. Make sure you are running in Node.js environment.`)\n        }\n    }\n}\n\nclass JSONLinesLoader extends TextLoader {\n    metadata?: ICommonObject\n    additionalMetadata: ICommonObject[] = []\n\n    constructor(filePathOrBlob: string | Blob, public pointer: string, metadata?: any) {\n        super(filePathOrBlob)\n        if (metadata) {\n            this.metadata = typeof metadata === 'object' ? metadata : JSON.parse(metadata)\n        }\n    }\n\n    async getAdditionalMetadata(): Promise<ICommonObject[]> {\n        return this.additionalMetadata\n    }","sourceCodeStart":272,"sourceCodeEnd":308,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/documentloaders/Jsonlines/Jsonlines.ts#L272-L308","documentation":"Thrown by TextLoader.imports() in Jsonlines.ts when import('node:fs/promises') rejects. Identical cause to Json.ts: the Node fs built-in is unavailable in the current runtime or stripped by a bundler.","triggerScenarios":"Browser/edge runtime without node:fs/promises; bundler not marking the module external; Node < 16; ESM/CJS interop dropping the node: scheme.","commonSituations":"Serverless browser runtime; misconfigured webpack/rollup/esbuild; corrupted Node install; old Node version.","solutions":["Run on Node >= 16, or pass a Blob instead of a file path to skip the fs branch.","Mark node:fs/promises as external in the bundler.","Upgrade Node.js.","Use the Blob input path for non-Node runtimes."],"exampleFix":"// before\nnew JSONLinesLoader('/data/log.jsonl', '/msg')\n// after\nconst blob = new Blob([text], { type: 'application/x-ndjson' })\nnew JSONLinesLoader(blob, '/msg')","handlingStrategy":"validation","validationCode":"function isNodeFsAvailable() {\n  try { require.resolve('node:fs/promises'); return true } catch { return false }\n}","typeGuard":"function isBlob(v) { return typeof Blob !== 'undefined' && v instanceof Blob }","tryCatchPattern":"try {\n  return await jsonLinesLoader.imports()\n} catch (e) {\n  if (/Failed to load fs\\/promises/.test(e.message)) {\n    throw new Error('Use Node.js or pass a Blob', { cause: e })\n  }\n  throw e\n}","preventionTips":["Pass a Blob for non-Node runtimes.","Mark node:fs/promises external in bundler config.","Run on Node >= 16.","Confirm runtime before file-path input."],"tags":["node","runtime","bundler","fs","environment"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}