Skip to content

fix: show helpful error when hive catalog config is missing uri#3077

Merged
kevinjqliu merged 2 commits intoapache:mainfrom
jx2lee:fix-when-urimissing
Feb 22, 2026
Merged

fix: show helpful error when hive catalog config is missing uri#3077
kevinjqliu merged 2 commits intoapache:mainfrom
jx2lee:fix-when-urimissing

Conversation

@jx2lee
Copy link
Contributor

@jx2lee jx2lee commented Feb 22, 2026

Closes #3069

Rationale for this change

When a catalog is explicitly configured with type: hive but uri is missing in .pyiceberg.yaml,
the CLI currently fails with a raw KeyError('uri'), which is surfaced as just:

'uri'

❯ cat .pyiceberg.yaml
catalog:
  my_hive_catalog:
    type: hive
    warehouse: warehouse_loc
❯ uv run pyiceberg --catalog my_hive_catalog list
'uri'

It's confusing for users because the command appears to return an identifier-like value instead of
a configuration error.

This change adds explicit validation for required catalog properties when the catalog type is already
specified (e.g. hive, rest, sql), so users get a clear actionable error message instead.

Are these changes tested?

Yes.

  • Added a CLI regression test for --catalog <name> list with type: hive and missing uri
  • Verified the error output contains a helpful URI missing... message and no longer prints 'uri'

Are there any user-facing changes?

Yes.

Users now see a clear error message (for example):

URI missing, please provide using --uri, the config or environment variable PYICEBERG_CATALOG__<CATALOG_NAME>__URI

instead of a raw 'uri' error when type: hive is configured without uri.

Copy link
Contributor

@kevinjqliu kevinjqliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kevinjqliu kevinjqliu merged commit 09de790 into apache:main Feb 22, 2026
13 checks passed
kris-gaudel pushed a commit to kris-gaudel/iceberg-python that referenced this pull request Mar 13, 2026
…he#3077)

Closes apache#3069 

  # Rationale for this change

When a catalog is explicitly configured with `type: hive` but `uri` is
missing in `.pyiceberg.yaml`,
the CLI currently fails with a raw `KeyError('uri')`, which is surfaced
as just:

  `'uri'`

```bash
❯ cat .pyiceberg.yaml
catalog:
  my_hive_catalog:
    type: hive
    warehouse: warehouse_loc
❯ uv run pyiceberg --catalog my_hive_catalog list
'uri'
```

It's confusing for users because the command appears to return an
identifier-like value instead of
  a configuration error.

This change adds explicit validation for required catalog properties
when the catalog type is already
specified (e.g. `hive`, `rest`, `sql`), so users get a clear actionable
error message instead.

  ## Are these changes tested?

  Yes.

- Added a CLI regression test for `--catalog <name> list` with `type:
hive` and missing `uri`
- Verified the error output contains a helpful `URI missing...` message
and no longer prints `'uri'`

  ## Are there any user-facing changes?

  Yes.

  Users now see a clear error message (for example):

`URI missing, please provide using --uri, the config or environment
variable PYICEBERG_CATALOG__<CATALOG_NAME>__URI`

instead of a raw `'uri'` error when `type: hive` is configured without
`uri`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CLI] Missing URI in .pyiceberg.yaml does not cause error for Hive catalog

2 participants