You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "mattfaltyn (via GitHub)" <gi...@apache.org> on 2026/07/18 19:28:31 UTC
[I] Python CLI `tables` commands return exit code 0 after API failures [polaris]
mattfaltyn opened a new issue, #5090:
URL: https://github.com/apache/polaris/issues/5090
### Describe the bug
The Python CLI's `tables list`, `tables get`, and `tables delete` commands catch API exceptions, print an error, and then return normally. As a result, the process exits with status `0` even though the requested operation failed.
Comparable commands such as `catalogs get` allow the API exception to reach the CLI's top-level handler and exit with status `1`. The CLI's existing exception constants also describe runtime/API failures as exit code `1`.
This makes failures difficult to detect reliably in shell scripts and CI jobs.
### How to reproduce
From `client/python`, mock a failed catalog API call and invoke the real CLI dispatcher:
```python
from unittest.mock import MagicMock, patch
from apache_polaris.cli.polaris_cli import PolarisCli
from apache_polaris.sdk.catalog.exceptions import ApiException
api = MagicMock()
api.api_client.configuration = MagicMock(
host="http://localhost:8181/api/management/v1",
username=None,
password=None,
access_token="token",
proxy=None,
proxy_headers=None,
)
api.api_client.default_headers = {}
with (
patch(
"apache_polaris.cli.polaris_cli.ApiClientBuilder.get_api_client",
return_value=MagicMock(),
),
patch("apache_polaris.cli.polaris_cli.PolarisDefaultApi", return_value=api),
patch("apache_polaris.cli.command.tables.IcebergCatalogAPI") as catalog_api,
):
catalog_api.return_value.load_table.side_effect = ApiException(
status=404, reason="Not Found"
)
PolarisCli.execute(
[
"--access-token", "redacted",
"tables", "get", "missing",
"--catalog", "c",
"--namespace", "n",
]
)
```
The command prints an error such as:
```text
[x] Table Load (missing) Not found
```
but the process exits with status `0`.
### Expected behavior
An API failure during `tables list`, `tables get`, or `tables delete` should exit with status `1`, consistent with the rest of the Python CLI's runtime/API error handling.
### Actual behavior
The failure is printed, execution returns normally, and the process exits with status `0`.
### Environment
- Current `main` at `7f0528705a2ab08ed4857be3e4046cecdd7b384c`
- Also reproducible in Apache Polaris 1.6.0
- Python 3.14.4 on macOS arm64
I searched existing open and closed issues and pull requests and did not find this behavior reported or being fixed. I would be happy to work on a focused fix and regression test if the proposed exit behavior is accepted.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Python CLI `tables` commands return exit code 0 after API failures [polaris]
Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode closed issue #5090: Python CLI `tables` commands return exit code 0 after API failures
URL: https://github.com/apache/polaris/issues/5090
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org