{"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/60108ba66eb7d1d12f595480091b4ad80a24b172/src/mono/browser/runtime/loader/polyfills.ts#L116-L152","documentation":"Thrown by the synthetic Response returned by fetch_like in polyfills.ts when running under NodeJS with a file:// URL (or when globalThis.fetch is absent) and the caller invokes response.text(). The Node file-loading path only implements arrayBuffer and json; reading the body as text is intentionally unimplemented, so text() throws NotImplementedException.","triggerScenarios":"A component of the runtime or user code calls response.text() on a Response returned for a file:// URL under Node; fetching a local resource via file:// and then asking for its text representation.","commonSituations":"Running tests under Node that fetch local config files; loading assets via file:// in SSR/desktop hosts; a library that always reads bodies as text.","solutions":["Read the body via arrayBuffer() or json() instead of text() for file:// URLs.","Serve the resource over http:// so fetch_like uses globalThis.fetch (Node 18+) which supports text().","Preload the file content yourself and pass it via config.resources.vfs instead of fetching."],"exampleFix":"// before: text() on a file:// Response under Node\nconst t = await (await fetch('file:///etc/cfg.json')).text();\n// after: use json() or an http URL\nconst j = await (await fetch('file:///etc/cfg.json')).json();","handlingStrategy":"validation","validationCode":"// before reading a body that may come from a file:// URL under Node\nif (url.startsWith('file://') && typeof globalThis.fetch !== 'function')\n    throw new Error('text() not supported on file:// under Node; use arrayBuffer()');","typeGuard":null,"tryCatchPattern":"try {\n  return await response.text();\n} catch (e) {\n  if (String(e).includes('NotImplementedException'))\n    return new TextDecoder().decode(await response.arrayBuffer());\n  throw e;\n}","preventionTips":["Prefer arrayBuffer()/json() over text() for file:// URLs under Node.","Serve local assets over http:// when text bodies are required.","Detect ENVIRONMENT_IS_NODE + url scheme before choosing the read method."],"tags":["node","fetch","file-url","polyfill","not-implemented"],"backgroundTag":null,"analyzedSha":"60108ba66eb7d1d12f595480091b4ad80a24b172","analyzedAt":"2026-08-10T18:54:11.478Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}