{"record":{"id":"d116e8b33a3f80dc","repo":"spectreconsole/spectre.console","slug":"failed-to-read-spinners-sindresorhus-json-at-file","errorCode":null,"errorMessage":"Failed to read spinners_sindresorhus.json at {file.Path}","messagePattern":"Failed to read spinners_sindresorhus\\.json at (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Spectre.Console.SourceGenerator/Spinners/SpinnerGenerator.cs","lineNumber":38,"sourceCode":"    public void Initialize(IncrementalGeneratorInitializationContext context)\n    {\n        // Find spinners_default.json\n        // Step 1: Extract text (cached by string value equality)\n        // Step 2: Wrap in EquatableArray for value equality when combining\n        var defaultSpinners = context.AdditionalTextsProvider\n            .Where(static file => file.Path.EndsWith(\"spinners_default.json\", StringComparison.OrdinalIgnoreCase))\n            .Select(static (file, ct) =>\n                file.GetText(ct)?.ToString()\n                ?? throw new InvalidOperationException($\"Failed to read spinners_default.json at {file.Path}\"))\n            .Collect()\n            .Select(static (arr, _) => new EquatableArray<string>(arr));\n\n        // Find spinners_sindresorhus.json\n        var sindreSpinners = context.AdditionalTextsProvider\n            .Where(static file => file.Path.EndsWith(\"spinners_sindresorhus.json\", StringComparison.OrdinalIgnoreCase))\n            .Select(static (file, ct) =>\n                file.GetText(ct)?.ToString()\n                ?? throw new InvalidOperationException($\"Failed to read spinners_sindresorhus.json at {file.Path}\"))\n            .Collect()\n            .Select(static (arr, _) => new EquatableArray<string>(arr));\n\n        // Combine both JSON files and parse in the pipeline (for caching)\n        // EquatableArray has value equality, so this step is properly cached\n        var spinners = defaultSpinners.Combine(sindreSpinners)\n            .Select(static (data, _) =>\n            {\n                var (defaultJsonFiles, sindreJsonFiles) = data;\n                if (defaultJsonFiles.IsEmpty || sindreJsonFiles.IsEmpty)\n                {\n                    return EquatableArray<SpinnerModel>.Empty;\n                }\n\n                var parsedSpinners = SpinnerParser.ParseAll(defaultJsonFiles[0], sindreJsonFiles[0]);\n                var validSpinners = parsedSpinners\n                    .Where(IsValidSpinner)\n                    .ToArray();","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/spectreconsole/spectre.console/blob/0acc92fada6c42f13984e79c2b5f3d993bdfb099/src/Spectre.Console.SourceGenerator/Spinners/SpinnerGenerator.cs#L20-L56","documentation":"Thrown inside the spinner source generator when an AdditionalFiles entry ending in spinners_sindresorhus.json matched but GetText returned null. Same shape as the default-spinner read failure; it surfaces as a compile-time InvalidOperationException in the generator pipeline.","triggerScenarios":"The spinners_sindresorhus.json AdditionalFiles item is in the graph but its text cannot be read at generation time (locked, deleted mid-build, unreadable, empty).","commonSituations":"Corrupted spinners_sindresorhus.json; antivirus/IDE lock; partial checkout; package restore that left the file missing or zero-byte.","solutions":["Clean rebuild (dotnet clean && dotnet build) to re-read AdditionalFiles","Confirm spinners_sindresorhus.json exists and is readable on disk","Restore/reinstall the Spectre.Console package to refresh the file","Release any process lock on spinners_sindresorhus.json"],"exampleFix":"# before: spinners_sindresorhus.json unreadable during generation\n# after: clean generation\ndotnet clean\ndotnet restore\ndotnet build","handlingStrategy":"validation","validationCode":"// Pre-build check: confirm spinners_sindresorhus.json AdditionalFiles item resolves\ndotnet msbuild -getItem:AdditionalFiles | findstr spinners_sindresorhus.json","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not hand-edit generator data files","CI step failing on zero-byte/missing data files prevents broken builds"],"tags":["source-generator","build","json","roslyn","spinner"],"backgroundTag":null,"analyzedSha":"0acc92fada6c42f13984e79c2b5f3d993bdfb099","analyzedAt":"2026-08-13T18:27:21.983Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}