iOfficeAI/OfficeCLI · error · CliException
invalid_issue_type
invalid_issue_type
Error message
Invalid --type value: '{issueType}'. Valid buckets: {string.Join(", ", BucketNames)} (alias {string.Join(", ", BucketAliases)}). Valid subtypes: {string.Join(", ", ValidSubtypes)}. What it means
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.
Source
Thrown at src/officecli/Core/IssueSubtypes.cs:114
/// <summary>
/// Validate a user-supplied <c>--type</c> argument and return the
/// canonicalised form. Null, empty, and whitespace-only inputs are
/// normalised to null (treated as "no filter"). Surrounding whitespace
/// is trimmed so values copied from shells with extra spaces still
/// match. Recognised buckets and subtypes (case-insensitive) pass
/// through unchanged. Anything else raises <see cref="CliException"/>
/// with the full valid list — turning silent typos into a clear
/// failure on both the CLI front-end and the resident-server fan-out.
/// </summary>
public static string? Validate(string? issueType)
{
if (string.IsNullOrWhiteSpace(issueType)) return null;
var trimmed = issueType.Trim();
var canonical = trimmed.ToLowerInvariant();
foreach (var v in ValidBuckets) if (v == canonical) return trimmed;
foreach (var v in ValidSubtypes) if (v == canonical) return trimmed;
var all = ValidBuckets.Concat(ValidSubtypes).ToArray();
throw new CliException(
$"Invalid --type value: '{issueType}'. Valid buckets: {string.Join(", ", BucketNames)} (alias {string.Join(", ", BucketAliases)}). Valid subtypes: {string.Join(", ", ValidSubtypes)}.")
{ Code = "invalid_issue_type", ValidValues = all };
}
}
View on GitHub (pinned to 1ced45e900)
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.
Example fix
// before — typo in bucket name view issues --type formatt doc.docx // after — correct bucket name view issues --type format doc.docx // or use an alias view issues --type f doc.docx
Defensive patterns
Strategy: validation
Validate before calling
// Pre-validate the --type value before calling view issues
var allValid = IssueSubtypes.ValidBuckets.Concat(IssueSubtypes.ValidSubtypes)
.ToHashSet(StringComparer.OrdinalIgnoreCase);
string? validated = null;
if (!string.IsNullOrWhiteSpace(requestedType))
{
string trimmed = requestedType.Trim();
if (allValid.Contains(trimmed.ToLowerInvariant()))
validated = trimmed;
else
Console.Error.WriteLine($"Invalid --type '{requestedType}'. Valid: {string.Join(", ", allValid)}");
}
// Pass validated (null if invalid) to the handler Try / catch
try
{
var issues = handler.ViewAsIssues(issueType: requestedType);
}
catch (CliException ex) when (ex.Code == "invalid_issue_type")
{
// ex.ValidValues contains the full valid list — show it to the user
Console.Error.WriteLine($"Valid --type values: {string.Join(", ", ex.ValidValues ?? Array.Empty<string>())}");
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- invalid_argument
- missing_argument
- batch: --commands and --input are mutually exclusive. Pick o
- invalid_value
- Input file not found: {inputFile.FullName}
AI-assisted analysis of iOfficeAI/OfficeCLI@1ced45e900 (2026-08-13).
Data as JSON: /api/errors/341ea5cd78e3c4dc.
Report an issue: GitHub.