{"record":{"id":"ed42e465a685ed48","repo":"spectreconsole/spectre.console","slug":"at-least-one-column-must-be-specified","errorCode":null,"errorMessage":"At least one column must be specified.","messagePattern":"At least one column must be specified\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Spectre.Console/Live/Progress/Progress.cs","lineNumber":198,"sourceCode":"/// Contains extension methods for <see cref=\"Progress\"/>.\n/// </summary>\npublic static class ProgressExtensions\n{\n    /// <summary>\n    /// Sets the columns to be used for an <see cref=\"Progress\"/> instance.\n    /// </summary>\n    /// <param name=\"progress\">The <see cref=\"Progress\"/> instance.</param>\n    /// <param name=\"columns\">The columns to use.</param>\n    /// <returns>The same instance so that multiple calls can be chained.</returns>\n    public static Progress Columns(this Progress progress, params ProgressColumn[] columns)\n    {\n        ArgumentNullException.ThrowIfNull(progress);\n\n        ArgumentNullException.ThrowIfNull(columns);\n\n        if (!columns.Any())\n        {\n            throw new InvalidOperationException(\"At least one column must be specified.\");\n        }\n\n        progress.Columns.Clear();\n        progress.Columns.AddRange(columns);\n\n        return progress;\n    }\n\n    /// <summary>\n    /// Sets an optional hook to intercept rendering.\n    /// </summary>\n    /// <param name=\"progress\">The <see cref=\"Progress\"/> instance.</param>\n    /// <param name=\"renderHook\">The custom render function.</param>\n    /// <returns>The same instance so that multiple calls can be chained.</returns>\n    public static Progress UseRenderHook(this Progress progress, Func<IRenderable, IReadOnlyList<ProgressTask>, IRenderable> renderHook)\n    {\n        progress.RenderHook = renderHook;\n","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/spectreconsole/spectre.console/blob/0acc92fada6c42f13984e79c2b5f3d993bdfb099/src/Spectre.Console/Live/Progress/Progress.cs#L180-L216","documentation":"Thrown by the Progress.Columns(this Progress, params ProgressColumn[]) extension method when the columns array is empty. Progress requires at least one column to render anything meaningful (e.g., TaskDescriptionColumn, ProgressBarColumn, PercentageColumn). Calling Columns() with no arguments produces a zero-length array via params, triggering the !columns.Any() guard.","triggerScenarios":"Calling AnsiConsole.Progress().Columns() with no arguments, or calling .Columns(someArray) where someArray is empty. This can also happen if columns are conditionally filtered out before being passed.","commonSituations":"Dynamically building the columns list from configuration and passing an empty list; refactoring that accidentally removes all column arguments; calling Columns() in a fluent chain where the params overload is invoked with zero args by mistake.","solutions":["Pass at least one ProgressColumn, e.g., .Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn()).","If building columns dynamically, ensure the collection is non-empty before calling Columns.","Default to the built-in column set and only override when you have at least one column."],"exampleFix":"// before\nvar progress = AnsiConsole.Progress().Columns();\n\n// after\nvar progress = AnsiConsole.Progress()\n    .Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn());","handlingStrategy":"validation","validationCode":"// Ensure at least one column\nvar columns = BuildColumns();\nif (columns.Length == 0)\n{\n    columns = new ProgressColumn[]\n    {\n        new TaskDescriptionColumn(),\n        new ProgressBarColumn(),\n        new PercentageColumn(),\n    };\n}\nAnsiConsole.Progress().Columns(columns);","typeGuard":"static bool HasAtLeastOneColumn(ProgressColumn[] columns)\n    => columns is { Length: > 0 };","tryCatchPattern":null,"preventionTips":["Default to the standard column set when building dynamically.","Validate columns array is non-empty before passing to Columns().","Audit refactoring that removes column arguments from a fluent chain."],"tags":["invalidoperationexception","progress","columns","configuration"],"backgroundTag":null,"analyzedSha":"0acc92fada6c42f13984e79c2b5f3d993bdfb099","analyzedAt":"2026-08-13T18:27:21.983Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}