Skip to content

fix: validate format before special handling #2204

Closed

Description

@TanvirTian

What happened in your environment?

The --format flag handles unsupported formats inconsistently

oras discover --format text returns:

Error: unsupported format type: text

while "text" is not supported by discover

Also, oras repo tags --format table prints the table deprecation warning even though table is not supported by repo tags

Users get misleading errors or warnings when they provide an unsupported --format value, making it harder to understand which formats are actually supported by the command.

What did you expect to happen?

The CLI should first check whether the given format is supported by the command.

If it isn't supported, it should show a clear error with the supported formats and avoid showing unrelated warnings.

How can we reproduce it?

Case 1: oras discover

  1. Create or use an OCI layout at /tmp/layout:v1.
  2. Run:
oras discover --oci-layout /tmp/layout:v1 --format text
  1. The CLI returns:
Error: unsupported format type: text

Case 2: oras repo tags

  1. Run:
oras repo tags <repository> --format table
  1. The CLI first prints:
Format "table" is deprecated and will be removed in a future release.
  1. It then returns:
Error: invalid format type: "table"
supported types: json, go-template, text
  1. Since table is not supported by oras repo tags, the deprecation warning should not be printed.

What is the version of your ORAS CLI?

Version: 1.3.4

What is your OS environment?

CachyOS Linux (x86_64)

Are you willing to submit PRs to fix it?

  • Yes, I am willing to fix it.

Activity

  1. added
    bug
    triage
    on Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugtriage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions