{"record":{"id":"7372a82f514d8b44","repo":"OrchardCMS/OrchardCore","slug":"could-not-find-a-resource-of-type-settings-type-named","errorCode":null,"errorMessage":"Could not find a resource of type '{settings.Type}' named '{settings.Name}' with version '{settings.Version ?? \"any\"}'.","messagePattern":"Could not find a resource of type '(.+?)' named '(.+?)' with version '(.+?)'\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/OrchardCore/OrchardCore.ResourceManagement/ResourceManager.cs","lineNumber":323,"sourceCode":"    {\n        return _styles ?? EmptyList<IHtmlContent>.Instance;\n    }\n\n    public IEnumerable<ResourceRequiredContext> GetRequiredResources(string resourceType)\n        => DoGetRequiredResources(resourceType);\n\n    private ResourceRequiredContext[] DoGetRequiredResources(string resourceType)\n    {\n        if (_builtResources.TryGetValue(resourceType, out var requiredResources) && requiredResources != null)\n        {\n            return requiredResources;\n        }\n\n        var allResources = new ResourceDictionary();\n        foreach (var settings in ResolveRequiredResources(resourceType))\n        {\n            var resource = FindResource(settings)\n                ?? throw new InvalidOperationException($\"Could not find a resource of type '{settings.Type}' named '{settings.Name}' with version '{settings.Version ?? \"any\"}'.\");\n\n            ExpandDependencies(resource, settings, allResources);\n        }\n\n        requiredResources = new ResourceRequiredContext[allResources.Count];\n        int i, first = 0, byDependency = allResources.FirstCount, last = allResources.Count - allResources.LastCount;\n        foreach (DictionaryEntry entry in allResources)\n        {\n            var settings = (RequireSettings)entry.Value;\n            if (settings.Position == ResourcePosition.First)\n            {\n                i = first++;\n            }\n            else if (settings.Position == ResourcePosition.Last)\n            {\n                i = last++;\n            }\n            else","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/OrchardCMS/OrchardCore/blob/4306c0717fe573f6fca1b4955909ddab6a192807/src/OrchardCore/OrchardCore.ResourceManagement/ResourceManager.cs#L305-L341","documentation":"ResourceManager.DoGetRequiredResources resolves every resource declared via RequireSettings (required resources for a page) and throws this InvalidOperationException when a manifest lookup by type/name/version finds no matching registered ResourceDefinition. It means the page requested a resource that no module registered, or the requested version does not exist.","triggerScenarios":"Calling GetRequiredResources, styleSheets, headScripts, footScripts, localScripts or localStyles after RequireSettings entries were added (e.g. via RequireSettings or ResourceManifest) whose type/name/version combination matches no registered resource, or whose version does not match the registered one.","commonSituations":"Typo in the resource name in a theme/module or recipe; module that registered the resource (its ResourceManifest) is disabled; hardcoded version string that no longer matches after a dependency upgrade; required resource declared in placement or theme settings pointing at a removed resource.","solutions":["Correct the resource name/type in the code or settings requesting it, matching the name declared in the module's ResourceManifest.","Check that the module or feature which registers the resource is enabled.","If a version is specified in the RequireSettings, remove it or set it to one that exists; 'any' matches the latest registered version.","Use ResourceManager/ResourceManagementOptions to list registered resources of that type to see valid names and versions."],"exampleFix":"// before\nbuilder.RequireSettings.Add(new RequireSettings { Type = \"script\", Name = \"jQuery-ui\", Version = \"1.12\" });\n// after\nbuilder.RequireSettings.Add(new RequireSettings { Type = \"script\", Name = \"jQuery-ui\" }); // existing registered name, no strict version","handlingStrategy":"validation","validationCode":"var registered = resourceManager.GetResources(resourceType); // or inspect manifests\nif (!registered.Any(r => r.Name == settings.Name && (settings.Version is null || r.GetVersion(settings.Version) != null)))\n    throw new InvalidOperationException($\"Resource '{resourceType}/{settings.Name}' v'{settings.Version ?? \"any\"}' is not registered.\");","typeGuard":"bool IsResourceRegistered(IEnumerable<ResourceDefinition> defs, RequireSettings s) =>\n    defs.Any(d => d.Name == s.Name && (s.Version is null || System.Version.TryParse(s.Version, out _) == false || d.Version == s.Version));","tryCatchPattern":"try\n{\n    var contexts = resourceManager.GetRequiredResources(resourceType);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"Could not find a resource of type\"))\n{\n    logger.LogWarning(ex, \"Missing resource; skipping render.\");\n}","preventionTips":["Keep resource names in a shared constants class used by both the manifest and consumers.","Avoid pinning versions unless you must; 'any' tolerates upgrades.","Verify module/feature enabling in recipes that depend on declared resources.","Search ResourceManifest definitions for the exact name before adding a Require call."],"tags":["resources","orchardcore","configuration","manifest"],"backgroundTag":"resource-not-found","analyzedSha":"4306c0717fe573f6fca1b4955909ddab6a192807","analyzedAt":"2026-09-13T17:41:05.024Z","contentChangedAt":"2026-09-13T17:41:05.024Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}