dotnet/runtime · critical · Error
Invalid config, resources is not set
Error message
Invalid config, resources is not set
What it means
Thrown by loadJSModule() (src/native/libs/Common/JavaScript/loader/assets.ts:44). After trying to resolve the JS module's URL (from asset.name via locateFile, or from a custom loadBootResourceCallback), if asset.resolvedUrl is still falsy the loader cannot import() the module and throws this config error.
Solutions
- Re-publish so every jsModule* asset entry has a name (the default publish output does this).
- If using a custom loadBootResourceCallback for dotnetjs assets, return a string URL for each.
- Validate the config's resources.jsModuleRuntime/jsModuleNative arrays contain entries with name before bootstrapping.
Example fix
// before: callback returns undefined for dotnetjs -> Invalid config, resources is not set
loadBootResource: (type, name, uri) => {
if (type === 'dotnetjs') return; // oops
return uri;
}
// after
loadBootResource: (type, name, uri) => uri; Defensive patterns
Strategy: validation
Validate before calling
function everyJsModuleHasName(resources: any): boolean {
const lists = ['jsModuleNative','jsModuleRuntime','modulesAfterConfigLoaded','modulesAfterRuntimeReady'];
return lists.every(k => (resources?.[k] ?? []).every((a: any) => !!a.name || !!a.resolvedUrl));
} Type guard
function isResolvableJsAsset(a: any): a is { name?: string; resolvedUrl?: string } {
return a && (typeof a.name === 'string' || typeof a.resolvedUrl === 'string');
} Prevention
- Re-publish so every jsModule* asset has a name.
- Return a string URL from a custom loadBootResourceCallback for dotnetjs assets.
- Validate jsModule arrays before bootstrapping.
When it happens
Trigger: loadJSModule is used for jsModuleNative/jsModuleRuntime/modulesAfterConfigLoaded/modulesAfterRuntimeReady assets. If the asset has no name and no resolvedUrl, and no custom callback provided one, line 64 throws.
Common situations: A runtime config that lists a JS module asset without a name; a custom loadBootResourceCallback that returned undefined for a dotnetjs asset; stripping/rewriting the boot config so jsModuleRuntime entries lose their name field.
Related errors
- Invalid runtime config, cannot initialize the runtime.
- Webcil asset ' ' is missing payloadSize in the boot config.
- must be marked with 'BlazorWebAssemblyLazyLoad' item group…
- must be marked with 'BlazorWebAssemblyLazyLoad' item group…
- Can't use moduleFactory callback of createDotnetRuntime…
AI-assisted analysis of dotnet/runtime@60108ba66e (2026-08-10).
Data as JSON: /api/errors/24779595b0250ee4.
Report an issue: GitHub.
Appendix: source
Thrown at src/native/libs/Common/JavaScript/loader/assets.ts:64
let mod: JsModuleExports = await asset.moduleExports;
if (mod) {
asset.moduleExports = mod;
}
totalAssetsToDownload++;
if (!mod) {
if (assetInternal.name && !asset.resolvedUrl) {
asset.resolvedUrl = locateFile(assetInternal.name, true);
}
assetInternal.behavior = "js-module-dotnet";
if (typeof loadBootResourceCallback === "function") {
const blazorType = behaviorToBlazorAssetTypeMap[assetInternal.behavior];
dotnetAssert.check(blazorType, `Unsupported asset behavior: ${assetInternal.behavior}`);
const customLoadResult = loadBootResourceCallback(blazorType, assetInternal.name, asset.resolvedUrl!, assetInternal.hash ?? "", assetInternal.behavior);
dotnetAssert.check(typeof customLoadResult === "string", "loadBootResourceCallback for JS modules must return string URL");
asset.resolvedUrl = makeURLAbsoluteWithApplicationBase(customLoadResult);
}
if (!asset.resolvedUrl) throw new Error("Invalid config, resources is not set");
mod = await import(/* webpackIgnore: true */ asset.resolvedUrl);
asset.moduleExports = mod;
}
onDownloadedAsset(assetInternal);
return mod;
}
export async function callLibraryInitializerOnRuntimeConfigLoaded(asset: JsAsset): Promise<any> {
const module = await loadJSModule(asset);
const name = asset.name || asset.resolvedUrl || "unknown";
try {
if (typeof module.onRuntimeConfigLoaded === "function") {
await module.onRuntimeConfigLoaded(loaderConfig);
}
return module;
} catch (err) {
const message = err instanceof Error ? err.message : String(err);
throw new Error(`Failed to invoke 'onRuntimeConfigLoaded' on library initializer '${name}': ${message}`, { cause: err });View on GitHub (pinned to 60108ba66e)