{"record":{"id":"24779595b0250ee4","repo":"dotnet/runtime","slug":"invalid-config-resources-is-not-set","errorCode":null,"errorMessage":"Invalid config, resources is not set","messagePattern":"Invalid config, resources is not set","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"src/native/libs/Common/JavaScript/loader/assets.ts","lineNumber":64,"sourceCode":"    let mod: JsModuleExports = await asset.moduleExports;\n    if (mod) {\n        asset.moduleExports = mod;\n    }\n    totalAssetsToDownload++;\n    if (!mod) {\n        if (assetInternal.name && !asset.resolvedUrl) {\n            asset.resolvedUrl = locateFile(assetInternal.name, true);\n        }\n        assetInternal.behavior = \"js-module-dotnet\";\n        if (typeof loadBootResourceCallback === \"function\") {\n            const blazorType = behaviorToBlazorAssetTypeMap[assetInternal.behavior];\n            dotnetAssert.check(blazorType, `Unsupported asset behavior: ${assetInternal.behavior}`);\n            const customLoadResult = loadBootResourceCallback(blazorType, assetInternal.name, asset.resolvedUrl!, assetInternal.hash ?? \"\", assetInternal.behavior);\n            dotnetAssert.check(typeof customLoadResult === \"string\", \"loadBootResourceCallback for JS modules must return string URL\");\n            asset.resolvedUrl = makeURLAbsoluteWithApplicationBase(customLoadResult);\n        }\n\n        if (!asset.resolvedUrl) throw new Error(\"Invalid config, resources is not set\");\n        mod = await import(/* webpackIgnore: true */ asset.resolvedUrl);\n        asset.moduleExports = mod;\n    }\n    onDownloadedAsset(assetInternal);\n    return mod;\n}\n\nexport async function callLibraryInitializerOnRuntimeConfigLoaded(asset: JsAsset): Promise<any> {\n    const module = await loadJSModule(asset);\n    const name = asset.name || asset.resolvedUrl || \"unknown\";\n    try {\n        if (typeof module.onRuntimeConfigLoaded === \"function\") {\n            await module.onRuntimeConfigLoaded(loaderConfig);\n        }\n        return module;\n    } catch (err) {\n        const message = err instanceof Error ? err.message : String(err);\n        throw new Error(`Failed to invoke 'onRuntimeConfigLoaded' on library initializer '${name}': ${message}`, { cause: err });","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/dotnet/runtime/blob/60108ba66eb7d1d12f595480091b4ad80a24b172/src/native/libs/Common/JavaScript/loader/assets.ts#L46-L82","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before: callback returns undefined for dotnetjs -> Invalid config, resources is not set\nloadBootResource: (type, name, uri) => {\n  if (type === 'dotnetjs') return; // oops\n  return uri;\n}\n\n// after\nloadBootResource: (type, name, uri) => uri;","handlingStrategy":"validation","validationCode":"function everyJsModuleHasName(resources: any): boolean {\n  const lists = ['jsModuleNative','jsModuleRuntime','modulesAfterConfigLoaded','modulesAfterRuntimeReady'];\n  return lists.every(k => (resources?.[k] ?? []).every((a: any) => !!a.name || !!a.resolvedUrl));\n}","typeGuard":"function isResolvableJsAsset(a: any): a is { name?: string; resolvedUrl?: string } {\n  return a && (typeof a.name === 'string' || typeof a.resolvedUrl === 'string');\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["configuration","js-modules","boot-config"],"backgroundTag":null,"analyzedSha":"60108ba66eb7d1d12f595480091b4ad80a24b172","analyzedAt":"2026-08-10T18:54:11.478Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}