Skip to content

AttributeError: 'NoneType' object has no attribute 'from_call' #659

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
parthea opened this issue May 24, 2024 · 2 comments · Fixed by #680
Closed

AttributeError: 'NoneType' object has no attribute 'from_call' #659

parthea opened this issue May 24, 2024 · 2 comments · Fixed by #680
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@parthea
Copy link
Collaborator

parthea commented May 24, 2024

In exceptions.py, if grpcio-status is not installed, rpc_status is set to None

try:
import grpc
try:
from grpc_status import rpc_status
except ImportError: # pragma: NO COVER
warnings.warn(
"Please install grpcio-status to obtain helpful grpc error messages.",
ImportWarning,
)
rpc_status = None
except ImportError: # pragma: NO COVER
grpc = None

In _parse_grpc_error_details, when rpc_status is None, this leads to AttributeError: 'NoneType' object has no attribute 'from_call'

def _parse_grpc_error_details(rpc_exc):
try:
status = rpc_status.from_call(rpc_exc)
except NotImplementedError: # workaround
return [], None

We should add a check to make sure rpc_status is not None before calling rpc_status.from_call(rpc_exc)

@parthea parthea added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. labels May 24, 2024
@LostInCode404
Copy link

I faced this issue when I was making API calls to gemini-1.5-pro model using langchain-google-genai module. Because of this issue, I could not initially understand the actual cause.

After reading this thread, I installed grpcio-status, after which I could see the actual error: 429 Resource has been exhausted (e.g. check quota).

@constructor-s
Copy link

I encountered the same issue. After installing grpcio-status I got InternalServerError: 500 An internal error has occurred. Please retry or report in https://developers.generativeai.google/guide/troubleshooting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants