dotnet/runtime · error · Error
Invalid config, resources is not set
Error message
Invalid config, resources is not set
What it means
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.
Source
Thrown at src/native/libs/Common/JavaScript/loader/run.ts:27
import { getIcuResourceName } from "./icu";
import { loaderConfig, validateLoaderConfig } from "./config";
import { fetchAssembly, fetchIcu, fetchNativeSymbols, fetchPdb, fetchSatelliteAssemblies, fetchVfs, fetchMainWasm, loadDotnetModule, loadJSModule, nativeModulePromiseController, verifyAllAssetsDownloaded, callLibraryInitializerOnRuntimeReady, callLibraryInitializerOnRuntimeConfigLoaded, prefetchAllResources, prefetchJSModuleLinks, resolveAllDownloadsQueued } from "./assets";
import { initPolyfillsLoader } from "./polyfills";
import { validateEngineFeatures } from "./bootstrap";
const runMainPromiseController = createPromiseCompletionSource<number>();
type DownloadMode = "none" | "cacheOnly" | "intoMemory";
let downloadMode: DownloadMode = "none";
let downloadDeferred: PromiseCompletionSource<void> | undefined;
let downloadedIntoMemory = false;
let configInitialized = false;
let modulesAfterConfigLoadedCache: [JsAsset, Promise<any>][] = [];
// many things happen in parallel here, but order matters for performance!
// ideally we want to utilize network and CPU at the same time
export async function createRuntime(downloadOnly: boolean, httpCacheOnly: boolean = false): Promise<any> {
if (!loaderConfig.resources || !loaderConfig.resources.coreAssembly || !loaderConfig.resources.coreAssembly.length) throw new Error("Invalid config, resources is not set");
try {
runtimeState.creatingRuntime = true;
// Re-entrancy guard: await any in-flight download, skip if already at requested level
if (downloadOnly) {
if (downloadDeferred) {
await downloadDeferred.promise;
}
if (downloadMode === "intoMemory" || (httpCacheOnly && downloadMode === "cacheOnly")) {
return;
}
downloadDeferred = createPromiseCompletionSource<void>();
}
// Fast path: download() already loaded everything into memory, create() just needs to init
if (downloadedIntoMemory && !downloadOnly) {
Module.runtimeKeepalivePush();
await initializeCoreCLR();View on GitHub (pinned to 290d5ab72c)
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.
Example fix
// before
builder.withConfig({ mainAssemblyName: 'App', resources: {} });
await builder.create(); // throws
// after
builder.withConfig({
mainAssemblyName: 'App',
resources: { coreAssembly: [{ name: 'System.Private.CoreLib.dll', hash: '...' }] }
});
await builder.create(); Defensive patterns
Strategy: validation
Validate before calling
const r = getLoaderConfig().resources;
if (!r?.coreAssembly?.length) {
throw new Error('Cannot create runtime — resources.coreAssembly is empty. Republish/merge boot config.');
} Type guard
function hasRuntimeResources(cfg: any): boolean {
return Array.isArray(cfg?.resources?.coreAssembly) && cfg.resources.coreAssembly.length > 0;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Loader configuration error: 'mainAssemblyName' is required.
- Loader configuration error: 'resources.coreAssembly' is requ
- Failed to invoke 'onRuntimeConfigLoaded' on library initiali
- Unexpected behavior ${asset.behavior} of asset ${asset.name}
- Missing window to the query parameters from
AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06).
Data as JSON: /api/errors/677eaf5b86b99733.
Report an issue: GitHub.