LykosAI/StabilityMatrix · warning · ValidationException
Unable to locate starting marker of last line
Error message
Unable to locate starting marker of last line
What it means
GenerationParameters.TryParse/Parse parses PNG-embedded generation-parameter text from A1111-style images. The parser expects the last non-empty line to begin with 'Steps:'; if it does not, the format is not recognized and a ValidationException is thrown naming the missing marker.
Solutions
- Ensure the last line of the parameter text starts with 'Steps:' before parsing
- Check the image metadata source — re-export or regenerate the image with a tool that embeds standard A1111 parameter blocks
- Wrap TryParse in a try-catch and treat ValidationException as 'parameters not parseable' rather than a crash
Example fix
// before
var pars = GenerationParameters.Parse(text);
// after
if (GenerationParameters.TryParse(text, out var pars)) { /* use pars */ } else { /* fall back to defaults */ } Defensive patterns
Strategy: validation
Validate before calling
var ok = text.Split("\r\n").LastOrDefault(l => !string.IsNullOrWhiteSpace(l))?.StartsWith("Steps:") == true;
if (!ok) /* handle unparsable parameters */; Try / catch
try { pars = GenerationParameters.Parse(text); } catch (ValidationException ex) { log.Warn(ex, "params unparsable"); pars = null; } Prevention
- Prefer TryParse over Parse when parameter text may be malformed
- Validate last line starts with 'Steps:' before parsing
- Sanity-check image metadata sources before import
When it happens
Trigger: Calling Parse (via TryParse) with text whose final line does not start with 'Steps:' — e.g. truncated prompt text, images saved by tools that reorder/omit the Steps line, or manually edited parameter blocks.
Common situations: Importing images generated by WebUI forks or other tools that write parameters in a different order; a paste/copy of parameter text missing the trailing Steps line; corrupted or trimmed metadata.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Fields line not found
- Invalid Token
- Sampler not selected
- Scheduler not selected
- Resources.Validation_PackageNameCannotBeEmpty
AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12).
Data as JSON: /api/errors/faf445b2df799e57.
Report an issue: GitHub.
Appendix: source
Thrown at StabilityMatrix.Core/Models/GenerationParameters.cs:79
}
public static GenerationParameters Parse(string text)
{
var lines = text.Split('\n');
if (lines.LastOrDefault() is not { } lastLine)
{
throw new ValidationException("Fields line not found");
}
if (lastLine.StartsWith("Steps:") != true)
{
lines = text.Split("\r\n");
lastLine = lines.LastOrDefault() ?? string.Empty;
if (lastLine.StartsWith("Steps:") != true)
{
throw new ValidationException("Unable to locate starting marker of last line");
}
}
// Join lines before last line, split at 'Negative prompt: '
var joinedLines = string.Join("\n", lines[..^1]).Trim();
// Apparently there is no space after the colon if value is empty, so check and add space here
if (joinedLines.EndsWith("Negative prompt:"))
{
joinedLines += ' ';
}
var splitFirstPart = joinedLines.Split("Negative prompt: ", 2);
var positivePrompt = splitFirstPart.ElementAtOrDefault(0)?.Trim();
var negativePrompt = splitFirstPart.ElementAtOrDefault(1)?.Trim();
// Parse last lineView on GitHub (pinned to af93d6ef57)