{"record":{"id":"ecec43b171c2e06f","repo":"LykosAI/StabilityMatrix","slug":"model-network-name-does-not-exist-in-index","errorCode":null,"errorMessage":"Model {network.Name} does not exist in index","messagePattern":"Model (.+?) does not exist in index","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Avalonia/Models/Inference/Prompt.cs","lineNumber":86,"sourceCode":"        LocalModelFile ModelFile,\n        double? ModelWeight,\n        double? ClipWeight\n    )> GetExtraNetworksAsLocalModels(IModelIndexService indexService)\n    {\n        if (ExtraNetworks is null)\n        {\n            throw new InvalidOperationException(\n                \"Prompt must be processed before calling GetExtraNetworksAsLocalModels\"\n            );\n        }\n\n        foreach (var network in ExtraNetworks)\n        {\n            var sharedFolderType = network.Type.ConvertTo<SharedFolderType>();\n\n            if (!indexService.ModelIndex.TryGetValue(sharedFolderType, out var modelList))\n            {\n                throw new ApplicationException($\"Model {network.Name} does not exist in index\");\n            }\n\n            var localModel = modelList.FirstOrDefault(m => m.FileNameWithoutExtension == network.Name);\n            if (localModel == null)\n            {\n                throw new ApplicationException($\"Model {network.Name} does not exist in index\");\n            }\n\n            yield return (localModel, network.ModelWeight, network.ClipWeight);\n        }\n    }\n\n    private int GetSafeEndIndex(int index)\n    {\n        return Math.Min(index, RawText.Length);\n    }\n\n    private (List<PromptExtraNetwork> promptExtraNetworks, string processedText) GetExtraNetworks(","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Avalonia/Models/Inference/Prompt.cs#L68-L104","documentation":"During GetExtraNetworksAsLocalModels(), each extra network's type is converted to a SharedFolderType and looked up in the model index. If the index has no models registered for that folder type, the method throws ApplicationException naming the network. The whole category of models (e.g. Lora) is absent from the index.","triggerScenarios":"An extra network like <lora:foo> whose SharedFolderType bucket has no entry in indexService.ModelIndex — e.g. the index was never built/refreshed, or the model type's shared folder is not configured.","commonSituations":"Fresh install or new shared-folder mode where the model index has not been refreshed; invoking inference before the index service finished scanning; prompts copied from another setup referencing model types not available locally.","solutions":["Refresh the model index (IModelIndexService.RefreshIndex) before running inference.","Ensure the referenced model type's shared folder exists and models are installed/imported.","Check indexService.ModelIndex.ContainsKey(sharedFolderType) before resolving, and skip unknown networks.","Wait for initial index build completion before enabling inference features."],"exampleFix":"// before\nforeach (var net in prompt.ExtraNetworks) { /* resolve */ }\n// after\nawait indexService.RefreshIndex();\nvar models = prompt\n    .GetExtraNetworksAsLocalModels(indexService)\n    .Where(t => t.LocalModel is not null);","handlingStrategy":"validation","validationCode":"await indexService.RefreshIndex();\nvar hasType = indexService.ModelIndex.ContainsKey(network.Type.ConvertTo<SharedFolderType>());","typeGuard":"bool TypeIndexed(IModelIndexService s, SharedFolderType t) => s.ModelIndex.TryGetValue(t, out _);","tryCatchPattern":"try { models = prompt.GetExtraNetworksAsLocalModels(indexService); }\ncatch (ApplicationException ex) { NotifyUserModelIndexIncomplete(ex.Message); }","preventionTips":["Refresh the model index after any model install/import and before inference runs.","Gate inference on an 'index ready' signal from the index service.","Install models for every shared folder type referenced by your prompts."],"tags":["model-index","lora","not-found"],"backgroundTag":"entity-not-found","analyzedSha":"af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002","analyzedAt":"2026-09-12T19:02:43.389Z","contentChangedAt":"2026-09-12T19:02:43.389Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}