{"record":{"id":"677eaf5b86b99733","repo":"dotnet/runtime","slug":"invalid-config-resources-is-not-set-677eaf","errorCode":null,"errorMessage":"Invalid config, resources is not set","messagePattern":"Invalid config, resources is not set","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/native/libs/Common/JavaScript/loader/run.ts","lineNumber":27,"sourceCode":"import { getIcuResourceName } from \"./icu\";\nimport { loaderConfig, validateLoaderConfig } from \"./config\";\nimport { fetchAssembly, fetchIcu, fetchNativeSymbols, fetchPdb, fetchSatelliteAssemblies, fetchVfs, fetchMainWasm, loadDotnetModule, loadJSModule, nativeModulePromiseController, verifyAllAssetsDownloaded, callLibraryInitializerOnRuntimeReady, callLibraryInitializerOnRuntimeConfigLoaded, prefetchAllResources, prefetchJSModuleLinks, resolveAllDownloadsQueued } from \"./assets\";\nimport { initPolyfillsLoader } from \"./polyfills\";\nimport { validateEngineFeatures } from \"./bootstrap\";\n\nconst runMainPromiseController = createPromiseCompletionSource<number>();\n\ntype DownloadMode = \"none\" | \"cacheOnly\" | \"intoMemory\";\nlet downloadMode: DownloadMode = \"none\";\nlet downloadDeferred: PromiseCompletionSource<void> | undefined;\nlet downloadedIntoMemory = false;\nlet configInitialized = false;\nlet modulesAfterConfigLoadedCache: [JsAsset, Promise<any>][] = [];\n\n// many things happen in parallel here, but order matters for performance!\n// ideally we want to utilize network and CPU at the same time\nexport async function createRuntime(downloadOnly: boolean, httpCacheOnly: boolean = false): Promise<any> {\n    if (!loaderConfig.resources || !loaderConfig.resources.coreAssembly || !loaderConfig.resources.coreAssembly.length) throw new Error(\"Invalid config, resources is not set\");\n    try {\n        runtimeState.creatingRuntime = true;\n\n        // Re-entrancy guard: await any in-flight download, skip if already at requested level\n        if (downloadOnly) {\n            if (downloadDeferred) {\n                await downloadDeferred.promise;\n            }\n            if (downloadMode === \"intoMemory\" || (httpCacheOnly && downloadMode === \"cacheOnly\")) {\n                return;\n            }\n            downloadDeferred = createPromiseCompletionSource<void>();\n        }\n\n        // Fast path: download() already loaded everything into memory, create() just needs to init\n        if (downloadedIntoMemory && !downloadOnly) {\n            Module.runtimeKeepalivePush();\n            await initializeCoreCLR();","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/native/libs/Common/JavaScript/loader/run.ts#L9-L45","documentation":"createRuntime() (loader/run.ts) re-checks at its entry that loaderConfig.resources exists, has coreAssembly, and coreAssembly.length > 0. This is a stricter duplicate of part of validateLoaderConfig() and guards the runtime creation path directly. It throws before doing any work.","triggerScenarios":"createRuntime() invoked (via HostBuilder.create/download/runMain/runMainAndExit) while loaderConfig.resources is unset, has no coreAssembly, or coreAssembly is an empty array. Effectively the same condition as error 62, hit one call-frame deeper.","commonSituations":"Calling create() with a config that has mainAssemblyName but missing/empty resources.coreAssembly; a later withConfig() merge replaced resources; partial boot config due to download/parse failure of blazor.boot.json.","solutions":["Ensure resources.coreAssembly is a non-empty array before calling create() — populate from a valid boot config.","Republish to regenerate blazor.boot.json / the embedded config.","Verify the config file was fetched and parsed (network tab, console) so resources was actually merged.","Avoid withConfig() calls that overwrite resources with an object lacking coreAssembly."],"exampleFix":"// before\nbuilder.withConfig({ mainAssemblyName: 'App', resources: {} });\nawait builder.create(); // throws\n\n// after\nbuilder.withConfig({\n  mainAssemblyName: 'App',\n  resources: { coreAssembly: [{ name: 'System.Private.CoreLib.dll', hash: '...' }] }\n});\nawait builder.create();","handlingStrategy":"validation","validationCode":"const r = getLoaderConfig().resources;\nif (!r?.coreAssembly?.length) {\n  throw new Error('Cannot create runtime — resources.coreAssembly is empty. Republish/merge boot config.');\n}","typeGuard":"function hasRuntimeResources(cfg: any): boolean {\n  return Array.isArray(cfg?.resources?.coreAssembly) && cfg.resources.coreAssembly.length > 0;\n}","tryCatchPattern":null,"preventionTips":["Run validateLoaderConfig() explicitly in your bootstrap before create().","Never let withConfig() overwrite resources with an object missing coreAssembly.","Add a CI assertion on blazor.boot.json structure."],"tags":["config","validation","startup","loader","runtime"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}