Skip to content

fix: incompatible flag errors should explain which option to use, not just state the conflict #401

@sonukapoor

Description

@sonukapoor

Problem

When incompatible flags are combined, the error only states the conflict:

Error: --fix cannot be used with --json
Error: --offline/--offline-db cannot be used with --osv-url
Error: --no-cache cannot be used with --offline or --offline-db

Users — especially in CI — don't know which flag to remove or why the combination is invalid.

Expected behaviour

Each conflict message should briefly explain the intent of each flag and guide the user:

Error: --fix cannot be used with --json. Use --fix to apply fixes interactively, or --json to output scan results as JSON — not both at once.
Error: --offline/--offline-db cannot be used with --osv-url. Choose offline mode (local DB) or online mode (custom OSV endpoint), not both.
Error: --no-cache cannot be used with --offline or --offline-db. In offline mode the local advisory DB is used directly; --no-cache only applies to online scans.

Where to look

src/index.ts — the flag-incompatibility throw statements around lines 108–128.

Acceptance criteria

  • All three conflict errors include a short explanation of what to do instead
  • No existing behaviour changes
  • Tests updated to assert the new message text

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions