From cac86efd17a9d5fb0c2819f9a7d027de7d7db5cb Mon Sep 17 00:00:00 2001 From: Ejiro Asiuwhu Date: Thu, 26 Mar 2026 09:44:19 +0100 Subject: [PATCH] fix: add None guard before model_validate in get_item methods Both sync and async get_item() were missing the None check that other getters (get_user, get_team) already have. An empty response body would surface as a pydantic ValidationError instead of a meaningful NotFoundError. --- sdks/implementations/python/src/stack_auth/_app.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdks/implementations/python/src/stack_auth/_app.py b/sdks/implementations/python/src/stack_auth/_app.py index 29ee9bf84..90851f988 100644 --- a/sdks/implementations/python/src/stack_auth/_app.py +++ b/sdks/implementations/python/src/stack_auth/_app.py @@ -1248,6 +1248,8 @@ class StackServerApp: data = self._client.request( "GET", f"/customers/{ctype}/{cid}/items/{item_id}" ) + if data is None: + raise NotFoundError(code="ITEM_NOT_FOUND", message=f"Item '{item_id}' not found") item = Item.model_validate(data) return ServerItem( item, @@ -2584,6 +2586,8 @@ class AsyncStackServerApp: data = await self._client.request( "GET", f"/customers/{ctype}/{cid}/items/{item_id}" ) + if data is None: + raise NotFoundError(code="ITEM_NOT_FOUND", message=f"Item '{item_id}' not found") item = Item.model_validate(data) return AsyncServerItem( item,