LykosAI/StabilityMatrix · error · InvalidOperationException
Expected colon.
Error message
Expected colon.
What it means
Thrown by ParseNetwork when the token after the network type should be a ':' separator scoped as 'punctuation.separator.variable.prompt' but is missing or scoped differently. The parser requires the strict '<type:name...>' structure.
Solutions
- Add the ':' separator between type and name: '<lora:name:0.8>'
- Do not put spaces or other characters between the type and ':'
- Verify the tokenizer scopes the ':' as punctuation.separator.variable.prompt
- Catch InvalidOperationException and highlight the malformed tag for the user
Example fix
// before var prompt = "<lora myModel:0.8>"; // after var prompt = "<lora:myModel:0.8>";
Defensive patterns
Strategy: validation
Validate before calling
bool HasColonSeparator(string tag) => System.Text.RegularExpressions.Regex.IsMatch(tag, "^<[a-zA-Z]+:");
Type guard
null
Try / catch
try { var node = builder.Parse(prompt); } catch (InvalidOperationException ex) when (ex.Message.Contains("Expected colon")) { // highlight the tag missing ':' after the type } Prevention
- Use ':' between type and name, never spaces or dashes
- Normalize tags from other tools before parsing (replace separators with ':')
- Avoid hand-editing tag internals; regenerate via UI
- Lint prompt tags for the strict '<type:name>' shape
When it happens
Trigger: Input like '<lora name:0.8>' (space instead of colon), '<lora-name:0.8>' if '-' tokenizes as something else, or '<lora>' with nothing following the type.
Common situations: Users rewriting LoRA tags by hand and omitting the colon; prompts converted between syntaxes that use spaces or '=' instead of ':'; autocomplete tools inserting the tag name without the separator.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- Expected opening bracket.
- Expected network type.
- Expected network name.
- Expected network weight.
- Expected closing bracket.
AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12).
Data as JSON: /api/errors/7953cd11943d8da4.
Report an issue: GitHub.
Appendix: source
Thrown at StabilityMatrix.Core/Models/PromptSyntax/PromptSyntaxBuilder.cs:252
private NetworkNode ParseNetwork()
{
var beginNetworkToken = ConsumeToken();
if (
beginNetworkToken is null
|| !beginNetworkToken.Scopes.Contains("punctuation.definition.network.begin.prompt")
)
throw new InvalidOperationException("Expected opening bracket.");
// type
var typeToken = PeekToken();
if (typeToken is null || !typeToken.Scopes.Contains("meta.embedded.network.type.prompt"))
throw new InvalidOperationException("Expected network type.");
var type = ParseIdentifier();
// colon
var colonToken = ConsumeToken();
if (colonToken is null || !colonToken.Scopes.Contains("punctuation.separator.variable.prompt"))
throw new InvalidOperationException("Expected colon.");
// name
var nameToken = PeekToken();
if (nameToken is null || !nameToken.Scopes.Contains("meta.embedded.network.model.prompt"))
throw new InvalidOperationException("Expected network name.");
var name = ParseText();
// model weight, clip weight
NumberNode? modelWeight = null;
NumberNode? clipWeight = null;
// colon
var nextToken = PeekToken();
if (nextToken is not null && nextToken.Scopes.Contains("punctuation.separator.variable.prompt"))
{
ConsumeToken(); // consume colon
// Parse the model weight.View on GitHub (pinned to af93d6ef57)