{"record":{"id":"423421b2ffa56a22","repo":"spectreconsole/spectre.console","slug":"value-cannot-be-null-parameter-header","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'header')","messagePattern":"Value cannot be null\\. \\(Parameter 'header'\\)","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Spectre.Console/Widgets/Table/TableColumn.cs","lineNumber":83,"sourceCode":"    /// </summary>\n    public Justify? Alignment { get; set; }\n\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"TableColumn\"/> class.\n    /// </summary>\n    /// <param name=\"header\">The table column header.</param>\n    public TableColumn(string header)\n        : this(new Markup(header).Overflow(Overflow.Ellipsis))\n    {\n    }\n\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"TableColumn\"/> class.\n    /// </summary>\n    /// <param name=\"header\">The <see cref=\"IRenderable\"/> instance to use as the table column header.</param>\n    public TableColumn(IRenderable header)\n    {\n        Header = header ?? throw new ArgumentNullException(nameof(header));\n        Width = null;\n        Padding = new Padding(1, 0, 1, 0);\n        NoWrap = false;\n        Alignment = null;\n    }\n}\n\n/// <summary>\n/// Contains extension methods for <see cref=\"TableColumn\"/>.\n/// </summary>\npublic static class TableColumnExtensions\n{\n    /// <summary>\n    /// Sets the table column header.\n    /// </summary>\n    /// <param name=\"column\">The table column.</param>\n    /// <param name=\"header\">The table column header markup text.</param>\n    /// <returns>The same instance so that multiple calls can be chained.</returns>","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/spectreconsole/spectre.console/blob/0acc92fada6c42f13984e79c2b5f3d993bdfb099/src/Spectre.Console/Widgets/Table/TableColumn.cs#L65-L101","documentation":"The TableColumn(IRenderable header) constructor requires a non-null header and throws ArgumentNullException on 'header'. The string overload wraps input in new Markup(header).Overflow(Ellipsis) then delegates to this constructor, so a null IRenderable passed directly is the trigger.","triggerScenarios":"new TableColumn((IRenderable)null); passing a nullable IRenderable that is null; a header factory returning null.","commonSituations":"Constructing columns in a loop from data where some entries produce null renderables; building columns before the header source is populated; deserialized/config-driven headers that can be absent.","solutions":["Pass a guaranteed non-null renderable: new TableColumn(header ?? new Markup(string.Empty)).","Prefer the string overload new TableColumn(\"text\") which never yields a null IRenderable.","Validate the header source before constructing columns."],"exampleFix":"// before\nvar col = new TableColumn(maybeNullRenderable);\n\n// after\nvar col = new TableColumn(maybeNullRenderable ?? new Markup(string.Empty));","handlingStrategy":"validation","validationCode":"ArgumentNullException.ThrowIfNull(header);\nvar col = new TableColumn(header ?? new Markup(string.Empty));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer the string overload new TableColumn(\"text\") for static headers.","Coalesce nullable renderables before constructing a column.","Enable nullable reference types to surface null header sources at compile time."],"tags":["table","column","null-reference","argument","constructor"],"backgroundTag":null,"analyzedSha":"0acc92fada6c42f13984e79c2b5f3d993bdfb099","analyzedAt":"2026-08-13T18:27:21.983Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}