{"record":{"id":"2f6515a452b91ca3","repo":"dotnet/runtime","slug":"no-fetch-implementation-available","errorCode":null,"errorMessage":"No fetch implementation available","messagePattern":"No fetch implementation available","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"src/mono/browser/runtime/loader/polyfills.ts","lineNumber":179,"sourceCode":"            url,\n            status: 500,\n            headers: {\n                length: 0,\n                get: () => null\n            },\n            statusText: \"ERR28: \" + e,\n            arrayBuffer: () => {\n                throw e;\n            },\n            json: () => {\n                throw e;\n            },\n            text: () => {\n                throw e;\n            }\n        };\n    }\n    throw new Error(\"No fetch implementation available\");\n}\n\n// context: the loadBootResource extension point can return URL/string which is unqualified.\n// For example `xxx/a.js` and we have to make it absolute\n// For compatibility reasons, it's based of document.baseURI even for JS modules like `./xxx/a.js`, which normally use script directory of a caller of `import`\n// Script directory in general doesn't match document.baseURI\nexport function makeURLAbsoluteWithApplicationBase (url: string) {\n    mono_assert(typeof url === \"string\", \"url must be a string\");\n    if (!isPathAbsolute(url) && url.indexOf(\"./\") !== 0 && url.indexOf(\"../\") !== 0 && globalThis.URL && globalThis.document && globalThis.document.baseURI) {\n        url = (new URL(url, globalThis.document.baseURI)).toString();\n    }\n    return url;\n}\n\nfunction normalizeFileUrl (filename: string) {\n    // unix vs windows\n    // remove query string\n    return filename.replace(/\\\\/g, \"/\").replace(/[?#].*/, \"\");","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/mono/browser/runtime/loader/polyfills.ts#L161-L197","documentation":"Thrown by fetch_like as the final fallthrough when none of the available code paths apply: the environment is not Node, globalThis.fetch is not a function, and the V8 shell `read` function is not available. It means there is no mechanism to load a URL at all.","triggerScenarios":"Produced when fetch_like cannot satisfy a request: not Node (so no fs), not a browser/Node-with-fetch, and not a V8 shell with read().","commonSituations":"Running in a minimal JS engine or sandbox that lacks both fetch and the read() global; a misconfigured environment detection (ENVIRONMENT_IS_NODE/_SHELL/_WEB all false) leaving no supported path.","solutions":["Ensure the host environment provides globalThis.fetch (modern browser or Node 18+).","If in a shell/sandbox, provide a global `read` function compatible with the V8 shell signature, or a fetch polyfill on globalThis.","Set a custom loaderHelpers.fetch_like implementation before booting the runtime.","Verify environment detection flags (ENVIRONMENT_IS_NODE etc.) are set correctly for your host."],"exampleFix":"// before: booting in a sandbox with no fetch and no read()\n// await createDotnetRuntime(opts); // throws 'No fetch implementation available'\n\n// after: install a fetch polyfill before boot\nglobalThis.fetch = myFetchImpl; // e.g. unfetch or a host-specific fetch\nawait createDotnetRuntime(opts);","handlingStrategy":"validation","validationCode":"function hasFetchOrRead() {\n  return typeof globalThis.fetch === 'function' || typeof (globalThis as any).read === 'function';\n}\nif (!hasFetchOrRead()) { /* install fetch polyfill before boot */ }","typeGuard":"function canFetch(): boolean {\n  return typeof globalThis.fetch === 'function' || typeof (globalThis as any).read === 'function';\n}","tryCatchPattern":null,"preventionTips":["Ensure globalThis.fetch is defined before booting the runtime.","In shells, provide a global read() or a custom loaderHelpers.fetch_like.","Validate environment detection flags for your host."],"tags":["fetch","environment","startup","polyfill"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}