{"record":{"id":"8755a8115f433110","repo":"LykosAI/StabilityMatrix","slug":"expected-network-name","errorCode":null,"errorMessage":"Expected network name.","messagePattern":"Expected network name\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Core/Models/PromptSyntax/PromptSyntaxBuilder.cs","lineNumber":257,"sourceCode":"            || !beginNetworkToken.Scopes.Contains(\"punctuation.definition.network.begin.prompt\")\n        )\n            throw new InvalidOperationException(\"Expected opening bracket.\");\n\n        // type\n        var typeToken = PeekToken();\n        if (typeToken is null || !typeToken.Scopes.Contains(\"meta.embedded.network.type.prompt\"))\n            throw new InvalidOperationException(\"Expected network type.\");\n        var type = ParseIdentifier();\n\n        // colon\n        var colonToken = ConsumeToken();\n        if (colonToken is null || !colonToken.Scopes.Contains(\"punctuation.separator.variable.prompt\"))\n            throw new InvalidOperationException(\"Expected colon.\");\n\n        // name\n        var nameToken = PeekToken();\n        if (nameToken is null || !nameToken.Scopes.Contains(\"meta.embedded.network.model.prompt\"))\n            throw new InvalidOperationException(\"Expected network name.\");\n        var name = ParseText();\n\n        // model weight, clip weight\n        NumberNode? modelWeight = null;\n        NumberNode? clipWeight = null;\n\n        // colon\n        var nextToken = PeekToken();\n        if (nextToken is not null && nextToken.Scopes.Contains(\"punctuation.separator.variable.prompt\"))\n        {\n            ConsumeToken(); // consume colon\n\n            // Parse the model weight.\n            var modelWeightToken = ConsumeToken();\n            if (modelWeightToken is null || !modelWeightToken.Scopes.Contains(\"constant.numeric\"))\n                throw new InvalidOperationException(\"Expected network weight.\");\n            modelWeight = ParseNumber();\n","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Core/Models/PromptSyntax/PromptSyntaxBuilder.cs#L239-L275","documentation":"Thrown by ParseNetwork when the token following the ':' after the network type is missing or not scoped as 'meta.embedded.network.model.prompt'. The parser needs the model file name (without extension) at that position. Message reads 'Expected network name.'","triggerScenarios":"Input like '<lora:>' with an empty name, '<lora::1.0>' with a second colon but no name, or input ending after the first ':'.","commonSituations":"Templates with '<lora:NAME:0.7>' placeholders left unfilled; users deleting the model name when editing prompts; tags copied from tools where the name part got truncated.","solutions":["Provide the model name after the colon: '<lora:myModel:0.8>'","Use the model file name without the .safetensors/.ckpt extension, matching how the tokenizer scopes it","Ensure no double colons or empty name segments inside the tag","Catch InvalidOperationException to reject malformed network tags with a clear message"],"exampleFix":"// before\nvar prompt = \"<lora::0.8>\";\n// after\nvar prompt = \"<lora:myModel:0.8>\";","handlingStrategy":"validation","validationCode":"bool HasModelName(string tag) => System.Text.RegularExpressions.Regex.IsMatch(tag, \"^<[a-zA-Z]+:[^:<> ]+\");","typeGuard":"null","tryCatchPattern":"try { var node = builder.Parse(prompt); } catch (InvalidOperationException ex) when (ex.Message.Contains(\"network name\")) { // report empty model name after ':' }","preventionTips":["Never leave the model name empty or the placeholder unfilled","Use the model file name without extension as the name segment","Reject tags with consecutive colons during validation","Prefill tag names from the model browser UI"],"tags":["parser","prompt-syntax","lora","model-name"],"backgroundTag":"missing-required-argument","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"}