{"record":{"id":"81e296840dae5359","repo":"spectreconsole/spectre.console","slug":"could-not-read-header-line","errorCode":null,"errorMessage":"Could not read header line","messagePattern":"Could not read header line","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Spectre.Console/Widgets/Figlet/FigletFontParser.cs","lineNumber":12,"sourceCode":"namespace Spectre.Console;\n\ninternal static class FigletFontParser\n{\n    public static FigletFont Parse(string source)\n    {\n        var lines = source.SplitLines();\n\n        var headerLine = lines.FirstOrDefault();\n        if (headerLine == null)\n        {\n            throw new InvalidOperationException(\"Could not read header line\");\n        }\n\n        var header = ParseHeader(headerLine);\n\n        var index = 32;\n        var indexOverridden = false;\n        var hasOverriddenIndex = false;\n        var buffer = new List<string>();\n        var characters = new List<FigletCharacter>();\n        var accumulatedHeight = 0;\n\n        var eolMarker = ParseEndOfLineMarker(lines, header);\n\n        foreach (var line in lines.Skip(header.CommentLines + 1))\n        {\n            // This might be an index?\n            if (!line.EndsWith(eolMarker))\n            {","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/spectreconsole/spectre.console/blob/0acc92fada6c42f13984e79c2b5f3d993bdfb099/src/Spectre.Console/Widgets/Figlet/FigletFontParser.cs#L1-L30","documentation":"Thrown by FigletFontParser.Parse when the source string contains no lines at all (FirstOrDefault returns null). This indicates the FIGlet font source is completely empty rather than merely malformed. The parser expects at least one header line.","triggerScenarios":"Calling FigletFontParser.Parse (directly or via FigletFont.Load) with an empty string, or loading a font file that is empty or unreadable yielding an empty string.","commonSituations":"Embedded resource returns empty due to wrong resource name or manifest lookup, reading a font file that was truncated/corrupted to zero bytes, or a network/HTTP fetch returning an empty body.","solutions":["Verify the font source string is non-empty before parsing.","Check that the embedded resource or file path resolves to a real FIGlet font file.","Load one of the built-in fonts (FigletFont.Default) as a fallback when the custom font source is empty."],"exampleFix":"// before\nvar font = FigletFont.Load(emptySource);\n\n// after\nvar font = string.IsNullOrWhiteSpace(emptySource) ? FigletFont.Default : FigletFont.Load(emptySource);","handlingStrategy":"validation","validationCode":"if (string.IsNullOrEmpty(source)) throw new ArgumentException(\"Figlet font source is empty\");\nvar font = FigletFontParser.Parse(source);","typeGuard":"static bool IsValidFontSource(string source) => !string.IsNullOrWhiteSpace(source);","tryCatchPattern":"try { var font = FigletFont.Load(source); }\ncatch (InvalidOperationException) { font = FigletFont.Default; }","preventionTips":["Verify embedded resource names match the assembly manifest.","Check file size is non-zero before reading font content."],"tags":["figlet","font-parsing","argument-validation","spectre-console"],"backgroundTag":null,"analyzedSha":"0acc92fada6c42f13984e79c2b5f3d993bdfb099","analyzedAt":"2026-08-13T18:27:21.983Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}