Skip to content

[ISSUE] Regression in NotFound error message handling #749

@asnare

Description

@asnare

Description

Some of the error handling seems to have changed in the 0.32.0 release, in particular the error message when looking up a non-existent group has changed from something like:

Group with id 1234 not found.

to:

request failed

This was encountered when calling WorkspaceClient().groups.get(id)

Reproduction

This session demonstrates the new situation in 0.32.0:

Python 3.10.14 (main, Mar 19 2024, 21:46:16) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from databricks.sdk import WorkspaceClient, version
>>> version.__version__
'0.32.0'
>>> ws = WorkspaceClient()
>>> ws.groups.get(1234)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/andrew.snare/dev/ucx-4/.venv/lib/python3.10/site-packages/databricks/sdk/service/iam.py", line 2364, in get
    res = self._api.do('GET', f'/api/2.0/preview/scim/v2/Groups/{id}', headers=headers)
  File "/Users/andrew.snare/dev/ucx-4/.venv/lib/python3.10/site-packages/databricks/sdk/core.py", line 155, in do
    response = retryable(self._perform)(method,
  File "/Users/andrew.snare/dev/ucx-4/.venv/lib/python3.10/site-packages/databricks/sdk/retries.py", line 54, in wrapper
    raise err
  File "/Users/andrew.snare/dev/ucx-4/.venv/lib/python3.10/site-packages/databricks/sdk/retries.py", line 33, in wrapper
    return func(*args, **kwargs)
  File "/Users/andrew.snare/dev/ucx-4/.venv/lib/python3.10/site-packages/databricks/sdk/core.py", line 273, in _perform
    raise error from None
databricks.sdk.errors.platform.NotFound: None request failed

Expected behavior

This is the behaviour on the previous (0.31.1) release:

Python 3.10.14 (main, Mar 19 2024, 21:46:16) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from databricks.sdk import WorkspaceClient, version
>>> version.__version__
'0.31.1'
>>> ws = WorkspaceClient()
>>> ws.groups.get(1234)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/andrew.snare/dev/ucx/.venv/lib/python3.10/site-packages/databricks/sdk/service/iam.py", line 2364, in get
    res = self._api.do('GET', f'/api/2.0/preview/scim/v2/Groups/{id}', headers=headers)
  File "/Users/andrew.snare/dev/ucx/.venv/lib/python3.10/site-packages/databricks/sdk/core.py", line 157, in do
    response = retryable(self._perform)(method,
  File "/Users/andrew.snare/dev/ucx/.venv/lib/python3.10/site-packages/databricks/sdk/retries.py", line 54, in wrapper
    raise err
  File "/Users/andrew.snare/dev/ucx/.venv/lib/python3.10/site-packages/databricks/sdk/retries.py", line 33, in wrapper
    return func(*args, **kwargs)
  File "/Users/andrew.snare/dev/ucx/.venv/lib/python3.10/site-packages/databricks/sdk/core.py", line 271, in _perform
    raise self._make_nicer_error(response=response, **payload) from None
databricks.sdk.errors.platform.NotFound: None Group with id 1234 not found.

Is it a regression?

This is a regression in 0.32.0 against the 0.31.1 release.

Debug Logs

The logs are identical for both.

Client setup:

INFO:databricks.sdk:loading DEFAULT profile from ~/.databrickscfg: host, auth_type
DEBUG:databricks.sdk:Ignoring pat auth, because databricks-cli is preferred
DEBUG:databricks.sdk:Ignoring basic auth, because databricks-cli is preferred
DEBUG:databricks.sdk:Ignoring metadata-service auth, because databricks-cli is preferred
DEBUG:databricks.sdk:Ignoring oauth-m2m auth, because databricks-cli is preferred
DEBUG:databricks.sdk:Ignoring azure-client-secret auth, because databricks-cli is preferred
DEBUG:databricks.sdk:Ignoring github-oidc-azure auth, because databricks-cli is preferred
DEBUG:databricks.sdk:Ignoring azure-cli auth, because databricks-cli is preferred
DEBUG:databricks.sdk:Ignoring external-browser auth, because databricks-cli is preferred
DEBUG:databricks.sdk:Attempting to configure auth: databricks-cli
INFO:databricks.sdk:Using Databricks CLI authentication

The call to get the (missing group):

DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): *redacted*.azuredatabricks.net:443
DEBUG:urllib3.connectionpool:https://*redacted*.azuredatabricks.net:443 "GET /api/2.0/preview/scim/v2/Groups/1234 HTTP/11" 404 None
DEBUG:databricks.sdk:GET /api/2.0/preview/scim/v2/Groups/1234
< 404 Not Found
< {
<   "detail": "Group with id 1234 not found.",
<   "schemas": [
<     "urn:ietf:params:scim:api:messages:2.0:Error"
<   ],
<   "status": "404"
< }

Other Information

  • OS: macOS
  • Version: 0.32.0

Additional context

We (UCX) discovered this when an (overnight) integration test failed: databrickslabs/ucx/issues/2539

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions