dotnet/runtime · error · Error

Unexpected behavior of asset

Error message

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

What it means

Thrown by normalizeConfig in config.ts when processing the deprecated config.assets array: an asset's behavior field does not match any known case (assembly, pdb, resource, icu, symbols, vfs, dotnetwasm, js-module-runtime, js-module-native, js-module-diagnostics, js-module-dotnet). It indicates a boot configuration / mono-config.json with an unrecognized asset behavior, typically from a custom config or an asset produced by a different runtime version.

Solutions

  1. Use the modern config.resources shape instead of the deprecated config.assets array.
  2. If using config.assets, set behavior to one of the known values (assembly, pdb, resource, icu, symbols, vfs, dotnetwasm, js-module-runtime, js-module-native, js-module-diagnostics, js-module-dotnet).
  3. Re-generate the config with the tooling matching your runtime version.

Example fix

// before: unknown behavior
config.assets = [{ name:'x', behavior:'foo' }];
// after: use config.resources
config.resources = { assembly: [{ name:'x', virtualPath:'x.dll' }] };
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)) throw new Error(`unknown asset behavior ${a.behavior}`);

Prevention

When it happens

Trigger: Hand-authoring a mono-config.json with a typo or unsupported behavior value; merging configs from an incompatible runtime version; a tool producing assets with an unknown behavior.

Common situations: Migrating between runtime versions that changed the asset behavior vocabulary; writing a custom config that uses the legacy config.assets shape; copy-paste typos like 'assembly ' (trailing space) or 'icU'.

Related errors


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

Appendix: 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 60108ba66e)