{"record":{"id":"a9a503c9dc234e09","repo":"spectreconsole/spectre.console","slug":"value-cannot-be-null-parameter-text","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'text')","messagePattern":"Value cannot be null\\. \\(Parameter 'text'\\)","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Spectre.Console/Widgets/PanelHeader.cs","lineNumber":25,"sourceCode":"{\n    /// <summary>\n    /// Gets the panel header text.\n    /// </summary>\n    public string Text { get; }\n\n    /// <summary>\n    /// Gets or sets the panel header alignment.\n    /// </summary>\n    public Justify? Justification { get; set; }\n\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"PanelHeader\"/> class.\n    /// </summary>\n    /// <param name=\"text\">The panel header text.</param>\n    /// <param name=\"alignment\">The panel header alignment.</param>\n    public PanelHeader(string text, Justify? alignment = null)\n    {\n        Text = text ?? throw new ArgumentNullException(nameof(text));\n        Justification = alignment;\n    }\n\n    /// <summary>\n    /// Sets the panel header style.\n    /// </summary>\n    /// <param name=\"style\">The panel header style.</param>\n    /// <returns>The same instance so that multiple calls can be chained.</returns>\n    [Obsolete(\"Use markup instead.\")]\n    [EditorBrowsable(EditorBrowsableState.Never)]\n    public PanelHeader SetStyle(Style? style)\n    {\n        return this;\n    }\n\n    /// <summary>\n    /// Sets the panel header style.\n    /// </summary>","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/spectreconsole/spectre.console/blob/0acc92fada6c42f13984e79c2b5f3d993bdfb099/src/Spectre.Console/Widgets/PanelHeader.cs#L7-L43","documentation":"Thrown by the PanelHeader constructor when the text argument is null. The header text is stored and rendered; a null title is not permitted even though an empty string is allowed.","triggerScenarios":"Constructing 'new PanelHeader(null)' or passing a null string variable.","commonSituations":"Title read from an optional config key that is absent, or a variable assigned null by default before a conditional that never sets it.","solutions":["Pass a non-null string, using string.Empty if no title text is desired.","Coalesce with '?? string.Empty' before constructing.","Validate the title source before use."],"exampleFix":"// before\nvar header = new PanelHeader(maybeNullTitle);\n\n// after\nvar header = new PanelHeader(maybeNullTitle ?? string.Empty);","handlingStrategy":"validation","validationCode":"if (text is null) throw new ArgumentNullException(nameof(text));\nvar header = new PanelHeader(text);","typeGuard":"static bool HasValidHeaderText(string? text) => text is not null;","tryCatchPattern":null,"preventionTips":["Use '?? string.Empty' for optional titles.","Validate config-sourced title strings before use."],"tags":["panel-header","argument-null","constructor","spectre-console"],"backgroundTag":null,"analyzedSha":"0acc92fada6c42f13984e79c2b5f3d993bdfb099","analyzedAt":"2026-08-13T18:27:21.983Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}