Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Standardize ErrorCategory and ErrorId for parameter conflict validation errors #26570

Copy link
Copy link
@yotsuda

Description

@yotsuda
Issue body actions

Summary of the new feature / enhancement

Parameter conflict validation errors (e.g., "Cannot specify both -X and -Y") currently use inconsistent ErrorCategory values across cmdlets:

Cmdlet Conflicting Parameters ErrorId ErrorCategory
Export-Csv / ConvertTo-Csv -QuoteFields / -UseQuotes CannotSpecifyQuoteFieldsAndUseQuotes InvalidData
Export-Csv / ConvertTo-Csv -IncludeTypeInformation / -NoTypeInformation CannotSpecifyIncludeTypeInformationAndNoTypeInformation InvalidData
Export-Csv -Path / -LiteralPath CannotSpecifyPathAndLiteralPath InvalidData
Export-Csv -Append / -NoHeader CannotSpecifyBothAppendAndNoHeader InvalidData
Select-String -Culture (requires -SimpleMatch) CannotSpecifyCultureWithoutSimpleMatch InvalidData
Format-Table / List / Custom -View / -Property FormatCannotSpecifyViewAndProperty InvalidArgument
Format-Wide -AutoSize / -Column FormatCannotSpecifyAutosizeAndColumns InvalidArgument

Note: Select-String's error is a dependency requirement rather than a mutual exclusion, but it shares the same inconsistency issue.

Standardizing ErrorCategory and ErrorId naming for parameter validation errors would improve consistency and make error handling more predictable for users and scripts.

Key questions for discussion:

  1. Can a cmdlet parameter be considered an "argument"? If yes, InvalidArgument would be semantically appropriate. If not, a new InvalidParameter category might be more accurate, though this would require PowerShell Committee approval as a public API change.
  2. Should ErrorId naming also be standardized? Currently there are two patterns: CannotSpecify... and FormatCannotSpecify....

Related: #26472 (discussion origin)

Proposed technical implementation details (optional)

Options include:

  • Option A: Standardize on InvalidArgument and FormatCannotSpecify... prefix (align with Format-* cmdlets)
  • Option B: Standardize on InvalidData and CannotSpecify... prefix (align with Csv/Select-String cmdlets)
  • Option C: Propose new InvalidParameter category with unified CannotSpecify... prefix (requires Committee approval, longer timeline)
mklement0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.WG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.