dotnet/runtime · error · Error

Unexpected behavior ${asset.behavior} of asset ${asset.name}

Error message

Unexpected behavior ${asset.behavior} of asset ${asset.name}

What it means

Thrown by normalizeConfig while iterating the deprecated config.assets array, when an asset's behavior string does not match any known case (assembly, pdb, resource, icu, symbols, vfs, dotnetwasm, js-module-*). It signals a malformed or unrecognized asset entry, typically from a hand-authored or version-mismatched config using the legacy assets format.

Source

Thrown at src/mono/browser/runtime/loader/config.ts:175

                    toMerge.vfs = [asset as VfsAsset];
                    break;
                case "dotnetwasm":
                    toMerge.wasmNative = [asset as WasmAsset];
                    break;
                case "js-module-runtime":
                    toMerge.jsModuleRuntime = [asset as JsAsset];
                    break;
                case "js-module-native":
                    toMerge.jsModuleNative = [asset as JsAsset];
                    break;
                case "js-module-diagnostics":
                    toMerge.jsModuleDiagnostics = [asset as JsAsset];
                    break;
                case "js-module-dotnet":
                    // don't merge loader
                    break;
                default:
                    throw new Error(`Unexpected behavior ${asset.behavior} of asset ${asset.name}`);
            }
            deep_merge_resources(config.resources, toMerge);
        }
    }

    if (config.debugLevel === undefined && BuildConfiguration === "Debug") {
        config.debugLevel = -1;
    }

    if (config.virtualWorkingDirectory === undefined) {
        config.virtualWorkingDirectory = browserVirtualAppBase;
    }

    if (!config.applicationEnvironment) {
        config.applicationEnvironment = "Production";
    }

    // ActiveIssue https://github.com/dotnet/runtime/issues/75602

View on GitHub (pinned to 290d5ab72c)

Solutions

  1. Use config.resources (the current format) instead of the deprecated config.assets array.
  2. If you must use config.assets, correct the offending asset's behavior to one of: assembly, pdb, resource, icu, symbols, vfs, dotnetwasm, js-module-runtime, js-module-native, js-module-diagnostics, js-module-dotnet.
  3. Regenerate the config with the matching SDK/runtime tooling so behaviors are emitted correctly.

Example fix

// before: deprecated assets with a typo'd behavior
dotnet.withConfig({
  assets: [{ name: 'x.dll', behavior: 'assembly ' /* trailing space */ }]
});

// after: use the resources format
dotnet.withConfig({
  resources: { assembly: [{ name: 'x.dll', behavior: 'assembly' }] }
});
Defensive patterns

Strategy: validation

Validate before calling

const knownBehaviors = new Set(['assembly','pdb','resource','icu','symbols','vfs','dotnetwasm','js-module-runtime','js-module-native','js-module-diagnostics','js-module-dotnet']);
for (const a of config.assets || []) {
  if (!knownBehaviors.has(a.behavior)) { /* fix or migrate to resources */ }
}

Type guard

function isValidAssetBehavior(b: string): boolean {
  return ['assembly','pdb','resource','icu','symbols','vfs','dotnetwasm','js-module-runtime','js-module-native','js-module-diagnostics','js-module-dotnet'].includes(b);
}

Prevention

When it happens

Trigger: Produced during config normalization when config.assets contains an entry whose `behavior` is an unknown/typo'd value (e.g. 'assembly ' with trailing space, 'resource2', or a value from a newer/older runtime version).

Common situations: Manually constructing monoConfig with an assets array and mistyping a behavior; using config.assets (deprecated) instead of config.resources; a config produced by a tool/SDK version that emits a behavior this older runtime does not understand.

Related errors


AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06). Data as JSON: /api/errors/869e5146d0f592e8. Report an issue: GitHub.