{"record":{"id":"6988dfb6ac1b6529","repo":"spectreconsole/spectre.console","slug":"value-cannot-be-null-parameter-content","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'content')","messagePattern":"Value cannot be null\\. \\(Parameter 'content'\\)","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Spectre.Console/Widgets/Panel.cs","lineNumber":68,"sourceCode":"    /// </summary>\n    internal bool Inline { get; set; }\n\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"Panel\"/> class.\n    /// </summary>\n    /// <param name=\"text\">The panel content.</param>\n    public Panel(string text)\n        : this(new Markup(text))\n    {\n    }\n\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"Panel\"/> class.\n    /// </summary>\n    /// <param name=\"content\">The panel content.</param>\n    public Panel(IRenderable content)\n    {\n        _child = content ?? throw new ArgumentNullException(nameof(content));\n    }\n\n    /// <inheritdoc/>\n    protected override Measurement Measure(RenderOptions options, int maxWidth)\n    {\n        var child = new Padder(_child, Padding);\n        return Measure(options, maxWidth, child);\n    }\n\n    private Measurement Measure(RenderOptions options, int maxWidth, IRenderable child)\n    {\n        var edgeWidth = (options.GetSafeBorder(this) is not NoBoxBorder) ? EdgeWidth : 0;\n        var childWidth = child.Measure(options, maxWidth - edgeWidth);\n\n        if (Width != null)\n        {\n            var width = Width.Value - edgeWidth;\n","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/spectreconsole/spectre.console/blob/0acc92fada6c42f13984e79c2b5f3d993bdfb099/src/Spectre.Console/Widgets/Panel.cs#L50-L86","documentation":"Thrown by the Panel(IRenderable) constructor when the content argument is null. A Panel requires a child renderable to draw inside its border. Note the string overload delegates to new Markup(text) which itself handles null text.","triggerScenarios":"Constructing 'new Panel((IRenderable)null)' or passing a variable of type IRenderable that is null.","commonSituations":"Passing a renderable obtained from a method that returned null, or an optional content variable that was not set.","solutions":["Pass a non-null IRenderable such as new Text(\"...\") or new Markup(\"...\").","Use the string overload 'new Panel(text)' which tolerates null via Markup.","Null-check before constructing the Panel."],"exampleFix":"// before\nvar panel = new Panel(maybeNullRenderable);\n\n// after\nvar panel = new Panel(maybeNullRenderable ?? new Text(string.Empty));","handlingStrategy":"type-guard","validationCode":"if (content is null) throw new ArgumentNullException(nameof(content));\nvar panel = new Panel(content);","typeGuard":"static bool HasValidPanelContent(IRenderable? content) => content is not null;","tryCatchPattern":null,"preventionTips":["Prefer the string overload new Panel(text) when content is a string.","Coalesce null renderables with a default before construction."],"tags":["panel","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"}