feat(chat): surface missing-model discovery errors as AgentStartupError#997
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves startup-time error reporting for LLM configuration by converting “model not found in discovery” failures into a structured AgentStartupError (LLM_INVALID_MODEL, category DEPLOYMENT). This aligns the chat-model dispatcher with the agent runtime’s structured error surface so deployments get actionable, user-facing guidance instead of an opaque exception.
Changes:
- Catch
ModelNotFoundErrorinchat_model_factory.get_chat_model()and re-raise asAgentStartupError, preserving the original exception as__cause__and tailoring the detail message for BYO connections. - Bump
uipath-llm-client/uipath-langchain-clientfloors to>=1.17.1,<1.18.0and version the package to0.14.11. - Add tests covering the mapping behavior, BYO detail variant, and cause chaining.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/uipath_langchain/chat/chat_model_factory.py |
Maps discovery “missing model” failures to structured startup errors with actionable guidance (including BYO connection messaging) and preserved __cause__. |
tests/chat/test_chat_model_factory.py |
Adds coverage for the error mapping behavior, BYO detail inclusion, and exception cause chaining. |
pyproject.toml |
Updates package version and floors client dependencies to include the new ModelNotFoundError. |
uv.lock |
Regenerates lockfile reflecting the dependency/version bumps. |
vldcmp-uipath
requested changes
Jul 21, 2026
tudormatei1
force-pushed
the
feat/model-not-found-startup-error
branch
from
July 21, 2026 09:04
e9bb399 to
5c60222
Compare
Addresses review feedback: the ModelNotFoundError handler imported AgentStartupError / AgentStartupErrorCode / UiPathErrorCategory lazily inside the except block to guard against a chat -> agent import cycle. Verified no such cycle exists (agent.exceptions only depends on uipath.runtime/uipath.platform, and test_no_circular_imports passes), so the imports are now at module top-level.
vldcmp-uipath
approved these changes
Jul 21, 2026
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What & why
When a model name isn't returned by the discovery API,
get_model_inforaisesModelNotFoundError. Until nowget_chat_modellet it propagate raw, so the runtime showed an opaque exception instead of an actionable message.This PR catches
ModelNotFoundErrorand re-raises it as a structuredAgentStartupError(codeLLM_INVALID_MODEL, categoryDEPLOYMENT). If abyo_connection_idis set, the message points to the connection's bring-your-own-model config; otherwise it asks you to check the model name and tenant enablement. The original error is preserved as__cause__.Changes
chat/chat_model_factory.py: mapsModelNotFoundErrortoAgentStartupError.AgentStartupError/UiPathErrorCategoryimported lazily inside the except block to avoid achat -> agentimport cycle.pyproject.toml:uipath-llm-client/uipath-langchain-clientfloors to>=1.17.1,<1.18.0; version to0.14.11.uv.lock: regenerated (resolves 1.17.1).TestGetChatModelModelNotFoundcovers the mapping, BYO variant, and__cause__chain.Depends on
uipath-llm-client1.17.1 (addsModelNotFoundError+UiPathLLMErrorCode.MODEL_NOT_FOUND). Already published.