{"record":{"id":"341ea5cd78e3c4dc","repo":"iOfficeAI/OfficeCLI","slug":"invalid-issue-type","errorCode":"invalid_issue_type","errorMessage":"Invalid --type value: '{issueType}'. Valid buckets: {string.Join(\", \", BucketNames)} (alias {string.Join(\", \", BucketAliases)}). Valid subtypes: {string.Join(\", \", ValidSubtypes)}.","messagePattern":"Invalid --type value: '(.+?)'\\. Valid buckets: (.+?) \\(alias (.+?)\\)\\. Valid subtypes: (.+?)\\.","errorType":"exception","errorClass":"CliException","httpStatus":null,"severity":"error","filePath":"src/officecli/Core/IssueSubtypes.cs","lineNumber":114,"sourceCode":"    /// <summary>\n    /// Validate a user-supplied <c>--type</c> argument and return the\n    /// canonicalised form. Null, empty, and whitespace-only inputs are\n    /// normalised to null (treated as \"no filter\"). Surrounding whitespace\n    /// is trimmed so values copied from shells with extra spaces still\n    /// match. Recognised buckets and subtypes (case-insensitive) pass\n    /// through unchanged. Anything else raises <see cref=\"CliException\"/>\n    /// with the full valid list — turning silent typos into a clear\n    /// failure on both the CLI front-end and the resident-server fan-out.\n    /// </summary>\n    public static string? Validate(string? issueType)\n    {\n        if (string.IsNullOrWhiteSpace(issueType)) return null;\n        var trimmed = issueType.Trim();\n        var canonical = trimmed.ToLowerInvariant();\n        foreach (var v in ValidBuckets) if (v == canonical) return trimmed;\n        foreach (var v in ValidSubtypes) if (v == canonical) return trimmed;\n        var all = ValidBuckets.Concat(ValidSubtypes).ToArray();\n        throw new CliException(\n            $\"Invalid --type value: '{issueType}'. Valid buckets: {string.Join(\", \", BucketNames)} (alias {string.Join(\", \", BucketAliases)}). Valid subtypes: {string.Join(\", \", ValidSubtypes)}.\")\n        { Code = \"invalid_issue_type\", ValidValues = all };\n    }\n}\n","sourceCodeStart":96,"sourceCodeEnd":119,"githubUrl":"https://github.com/iOfficeAI/OfficeCLI/blob/1ced45e900782c5083ed550ddf328ee974e425e7/src/officecli/Core/IssueSubtypes.cs#L96-L119","documentation":"Thrown by IssueSubtypes.Validate when the --type argument for 'view issues' does not match any accepted bucket name, bucket alias, or subtype. Accepted buckets are 'format', 'content', 'structure' (with aliases 'f', 'c', 's'). Accepted subtypes are specific issue identifiers like 'formula_not_evaluated', 'low_contrast', etc. The error includes the full valid list and sets Code='invalid_issue_type' and ValidValues for programmatic consumers. Case-insensitive, whitespace-trimmed.","triggerScenarios":"Running 'view issues --type formatt' (typo), '--type form' (partial match, not an alias), or '--type accessibility' (not a valid bucket or subtype). Calling IssueSubtypes.Validate(\"charts\") where 'charts' is not in ValidBuckets or ValidSubtypes. The validator first checks buckets (format/content/structure + f/c/s), then subtypes; if neither matches, it throws.","commonSituations":"A user who guesses a bucket name instead of consulting help. A typo in a batch script. A version mismatch where a subtype was renamed or removed but the caller's script still references the old name. An agent that hallucinated an issue type name.","solutions":["Use one of the valid bucket names: 'format', 'content', 'structure' (or aliases 'f', 'c', 's').","Use a valid subtype name exactly as listed (e.g. 'formula_not_evaluated', 'low_contrast').","Run 'view issues --help' or check IssueSubtypes.TypeHelpDescription() for the complete current list.","If filtering by a subtype that doesn't apply to the current format, note that it returns count=0 (not an error) — only truly unrecognized values throw."],"exampleFix":"// before — typo in bucket name\nview issues --type formatt doc.docx\n\n// after — correct bucket name\nview issues --type format doc.docx\n// or use an alias\nview issues --type f doc.docx","handlingStrategy":"validation","validationCode":"// Pre-validate the --type value before calling view issues\nvar allValid = IssueSubtypes.ValidBuckets.Concat(IssueSubtypes.ValidSubtypes)\n    .ToHashSet(StringComparer.OrdinalIgnoreCase);\n\nstring? validated = null;\nif (!string.IsNullOrWhiteSpace(requestedType))\n{\n    string trimmed = requestedType.Trim();\n    if (allValid.Contains(trimmed.ToLowerInvariant()))\n        validated = trimmed;\n    else\n        Console.Error.WriteLine($\"Invalid --type '{requestedType}'. Valid: {string.Join(\", \", allValid)}\");\n}\n// Pass validated (null if invalid) to the handler","typeGuard":null,"tryCatchPattern":"try\n{\n    var issues = handler.ViewAsIssues(issueType: requestedType);\n}\ncatch (CliException ex) when (ex.Code == \"invalid_issue_type\")\n{\n    // ex.ValidValues contains the full valid list — show it to the user\n    Console.Error.WriteLine($\"Valid --type values: {string.Join(\", \", ex.ValidValues ?? Array.Empty<string>())}\");\n}","preventionTips":["Reference IssueSubtypes.ValidBuckets and IssueSubtypes.ValidSubtypes for the current accepted list.","Use the bucket names (format/content/structure) or their aliases (f/c/s) for broad filtering.","In batch scripts, validate --type values against the current IssueSubtypes arrays before replaying."],"tags":["cli","issues","type-validation","argument-validation","typo-detection"],"backgroundTag":null,"analyzedSha":"1ced45e900782c5083ed550ddf328ee974e425e7","analyzedAt":"2026-08-13T13:01:07.193Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}