{"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/60108ba66eb7d1d12f595480091b4ad80a24b172/src/mono/browser/runtime/loader/polyfills.ts#L161-L197","documentation":"Thrown by fetch_like in polyfills.ts as the final fallthrough: the caller is not in a Node context, globalThis.fetch is not a function, and the global read function (V8 shell) is absent. No mechanism remains to fetch the resource, so the loader aborts.","triggerScenarios":"Running the wasm runtime in a bare JS engine (V8/d8, JavaScriptCore shell, an embedded runtime) that provides neither fetch nor the d8 read() global; an environment where globalThis.fetch was deleted or never provided; a misdetected environment (ENVIRONMENT_IS_NODE/WEB/SHELL all false).","commonSituations":"Custom embedding of the runtime in a non-browser host without providing a fetch implementation; sandboxing that removes fetch; an engine detection bug in the host.","solutions":["Provide a fetch polyfill on globalThis.fetch before starting the runtime (whatwg-fetch, node-fetch, undici, or a custom shim).","If embedding in a shell, set loaderHelpers.fetch_like to your own fetch implementation via the module config.","Correct the environment detection so ENVIRONMENT_IS_NODE/WEB/SHELL matches your host and the right fetch path is taken."],"exampleFix":"// before: no fetch in custom host\n// after: install a shim before booting the runtime\nglobalThis.fetch = (url, init) => myHttpLib.request(url, init);","handlingStrategy":"fallback","validationCode":"// before booting, ensure some fetch exists\nif (typeof globalThis.fetch !== 'function' && typeof globalThis.read !== 'function') {\n  throw new Error('No fetch available; install a polyfill');\n}","typeGuard":"function hasFetchLike(): boolean {\n  return typeof globalThis.fetch === 'function' || typeof (globalThis as any).read === 'function';\n}","tryCatchPattern":null,"preventionTips":["Install a fetch polyfill (whatwg-fetch, node-fetch, undici) in non-browser hosts.","When embedding, set loaderHelpers.fetch_like to your own implementation.","Verify environment detection flags so the correct fetch path is used."],"tags":["fetch","polyfill","embedding","startup","environment"],"backgroundTag":null,"analyzedSha":"60108ba66eb7d1d12f595480091b4ad80a24b172","analyzedAt":"2026-08-10T18:54:11.478Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}