{"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":"validation","errorClass":"Error","httpStatus":null,"severity":"error","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/290d5ab72cc1102813fbc0406fb186ceadabc340/src/native/libs/Common/JavaScript/loader/assets.ts#L46-L82","documentation":"Thrown inside loadJSModule (loader/assets.ts) after the loader tried to resolve a URL via locateFile(asset.name) but asset.resolvedUrl is still falsy. This means the JS-module asset (native/runtime/diagnostics module) has neither a pre-resolved URL nor a name the loader can turn into one, so the dynamic import() target is unknown.","triggerScenarios":"resources.jsModuleNative / jsModuleRuntime / jsModuleDiagnostics / modulesAfterConfigLoaded contains an entry with both resolvedUrl and name unset/empty. locateFile only runs when asset.name is truthy; if name is empty, resolvedUrl stays undefined and this throws.","commonSituations":"Hand-edited boot config where a JS module asset object is empty {}; a custom resource loader (loadBootResourceCallback) returned undefined and cleared resolvedUrl; corrupted publish output where jsModuleRuntime[0] lost its name field.","solutions":["Inspect loaderConfig.resources.jsModule* entries and ensure every asset has either a non-empty name or a resolvedUrl.","Republish the project to regenerate a well-formed boot config.","If injecting custom JS module assets programmatically, set both name and resolvedUrl explicitly.","Check that a loadBootResourceCallback (withResourceLoader) is not returning undefined for dotnetjs resources."],"exampleFix":"// before\nresources.jsModuleRuntime = [{ }];\n\n// after\nresources.jsModuleRuntime = [{ name: 'dotnet.runtime.js', resolvedUrl: '/_framework/dotnet.runtime.js' }];","handlingStrategy":"validation","validationCode":"// Validate every JS-module asset has a resolvable URL\nfor (const m of [...(cfg.resources?.jsModuleNative ?? []), ...(cfg.resources?.jsModuleRuntime ?? [])]) {\n  if (!m.resolvedUrl && !m.name) throw new Error(`JS module asset missing name and resolvedUrl`);\n}","typeGuard":"function isResolvableJsAsset(a: any): a is { name: string; resolvedUrl?: string } {\n  return typeof a?.name === 'string' && a.name.length > 0\n      || typeof a?.resolvedUrl === 'string';\n}","tryCatchPattern":null,"preventionTips":["Never write empty {} entries into jsModule* arrays.","After merging config, assert every jsModule asset has name or resolvedUrl.","Republish rather than hand-editing boot config."],"tags":["config","assets","js-module","url","loader"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}