{"record":{"id":"8645a89a19ce4be8","repo":"dotnet/runtime","slug":"notimplementedexception","errorCode":null,"errorMessage":"NotImplementedException","messagePattern":"NotImplementedException","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/mono/browser/runtime/loader/polyfills.ts","lineNumber":134,"sourceCode":"                // @ts-ignore:\n                node_fs = await import(/*! webpackIgnore: true */\"fs\");\n            }\n            if (isFileUrl) {\n                url = node_url.fileURLToPath(url);\n            }\n\n            const arrayBuffer = await node_fs.promises.readFile(url);\n            return <Response><any>{\n                ok: true,\n                headers: {\n                    length: 0,\n                    get: () => null\n                },\n                url,\n                arrayBuffer: () => arrayBuffer,\n                json: () => JSON.parse(arrayBuffer),\n                text: () => {\n                    throw new Error(\"NotImplementedException\");\n                }\n            };\n        } else if (hasFetch) {\n            return globalThis.fetch(url, init || { credentials: \"same-origin\" });\n        } else if (typeof (read) === \"function\") {\n            // note that it can't open files with unicode names, like Stra<unicode char - Latin Small Letter Sharp S>e.xml\n            // https://bugs.chromium.org/p/v8/issues/detail?id=12541\n            return <Response><any>{\n                ok: true,\n                url,\n                headers: {\n                    length: 0,\n                    get: () => null\n                },\n                arrayBuffer: () => {\n                    return new Uint8Array(read(url, \"binary\"));\n                },\n                json: () => {","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/mono/browser/runtime/loader/polyfills.ts#L116-L152","documentation":"Thrown inside the fake Response.text() implementation of fetch_like when running under Node and loading a file:// URL. The Node file-backed response supports arrayBuffer() and json() but deliberately throws NotImplementedException for text(), because the implementors chose not to decode text for local files in that path.","triggerScenarios":"Produced when something in the runtime calls response.text() on a Response returned by fetch_like for a Node file:// resource. The response object's text() method unconditionally throws 'NotImplementedException'.","commonSituations":"A library or runtime subsystem that expects .text() on boot/resource responses under Node; reading a config or asset as text from the local filesystem in Node when the runtime uses the file-path code branch.","solutions":["Avoid calling .text() on file:// responses in Node; use .arrayBuffer() or .json() instead, then decode bytes yourself.","Load the resource over http(s):// instead of file:// so the native fetch code path (which supports text()) is used.","Provide a custom loaderHelpers.fetch_like that returns a Response with a working text() implementation for local files."],"exampleFix":"// before: calling text() on a Node file:// response\n// const text = await (await fetch_like('file:///app/x.json')).text();\n\n// after: use arrayBuffer and decode, or json()\nconst buf = await (await fetch_like('file:///app/x.json')).arrayBuffer();\nconst text = new TextDecoder().decode(buf);","handlingStrategy":"fallback","validationCode":"// Probe whether the response supports text() before using it\nasync function safeText(resp) {\n  try {\n    return await resp.text();\n  } catch {\n    const buf = await resp.arrayBuffer();\n    return new TextDecoder().decode(buf);\n  }\n}","typeGuard":"function responseSupportsText(resp: any): boolean {\n  return typeof resp.text === 'function' && resp.headers?.get?.('__no_text__') !== true;\n}","tryCatchPattern":"try {\n  text = await resp.text();\n} catch (e) {\n  if (/NotImplemented/i.test(String(e))) {\n    text = new TextDecoder().decode(await resp.arrayBuffer());\n  } else throw e;\n}","preventionTips":["Under Node, prefer arrayBuffer()/json() over text() for file:// responses.","Install a custom fetch_like that returns a fully-featured Response for local files.","Load assets over http(s):// in Node to use the native fetch code path."],"tags":["node","fetch","polyfill","filesystem"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}