fix: catch protobuf TypeError on optional streamlit import#203
Merged
fix: catch protobuf TypeError on optional streamlit import#203
Conversation
…tions - Remove langchain-classic from pip deps (requires langchain-core>=1.2.19, conflicts with conda langchain 0.3.x; only used as fallback import) - Pin langchain-anthropic<1.0.0 to stay compatible with langchain-core<1.0.0 - Move npm install before uvicorn start to prevent reload-triggered ETIMEDOUT - Add --reload-exclude for frontend/node_modules to uvicorn command
…I context Streamlit's protobuf files can raise TypeError (not ImportError) when the installed protobuf version is incompatible. This crashes the FastAPI backend even though it doesn't use streamlit. Broadening the except clause to Exception prevents the crash.
dmpantiu
approved these changes
Mar 27, 2026
Collaborator
dmpantiu
left a comment
There was a problem hiding this comment.
LGTM. The except Exception fix for streamlit protobuf TypeError is correct — both files already treat streamlit as optional (st = None fallback).
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.
Summary
except ImportErrortoexcept Exceptionfor optionalimport streamlitinera5_retrieval_tool.pyanddestine_retrieval_tool.py_pb2.pyfiles, aTypeErroris raised — notImportError— which crashes the backend.st = Nonefallback), so catching any exception is the correct behavior.Test plan
uvicorn api.main:app --host 0.0.0.0 --port 8000 --reload— no protobuf crash on startupstreamlit run src/climsight/climsight.py