From 35aa98b11068ba3c3d66dbfe77d176a66413e72e Mon Sep 17 00:00:00 2001 From: Kavya Goyal Date: Fri, 7 Nov 2025 18:21:35 +0530 Subject: [PATCH] fix(sdk-py): use correct f-string representation when loading error (#6388) Thank you for contributing to LangGraph! Follow these steps to mark your pull request as ready for review. **If any of these steps are not completed, your PR will not be considered for review.** ## Description - Fixed a bug in `libs/sdk-py/langgraph_sdk/auth/__init__.py` where the error message for an already-set authentication handler did not properly render the handler value. - Updated the error string from a static `{self._authenticate_handler}` to a correctly interpolated f-string. ```python "Authentication handler already set as {self._authenticate_handler}." ``` ```python f"Authentication handler already set as {self._authenticate_handler}." ``` - Error messages now correctly display the actual handler instance, improving debugging clarity. - **Issue:** Fixes https://github.com/langchain-ai/langgraph/issues/6387 - **Dependencies:** - - **Twitter handle:** - - [x] **Add tests and docs**: If you're adding a new integration, you must include: 1. A test for the integration, preferably unit tests that do not rely on network access, 2. An example notebook showing its use. It lives in `docs/docs/integrations` directory. - [ ] **Lint and test**: Run `make format`, `make lint` and `make test` from the root of the package(s) you've modified. We will not consider a PR unless these three are passing in CI. See [contribution guidelines](https://github.com/langchain-ai/langgraph/blob/main/CONTRIBUTING.md) for more. Additional guidelines: - Make sure optional dependencies are imported within a function. - Please do not add dependencies to `pyproject.toml` files (even optional ones) unless they are **required** for unit tests. - Most PRs should not touch more than one package. - Changes should be backwards compatible. --- libs/sdk-py/langgraph_sdk/auth/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/sdk-py/langgraph_sdk/auth/__init__.py b/libs/sdk-py/langgraph_sdk/auth/__init__.py index 3379affac..3cfd0574e 100644 --- a/libs/sdk-py/langgraph_sdk/auth/__init__.py +++ b/libs/sdk-py/langgraph_sdk/auth/__init__.py @@ -259,7 +259,7 @@ class Auth: """ if self._authenticate_handler is not None: raise ValueError( - "Authentication handler already set as {self._authenticate_handler}." + f"Authentication handler already set as {self._authenticate_handler}." ) self._authenticate_handler = fn return fn