Skip to content

[Bug] payload assignment in exceptions.py does not handle list type correctly #830

@AlexChim1231

Description

@AlexChim1231

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

Please run down the following list and make sure you've tried the usual "quick fixes":

If you are still having issues, please be sure to include as much information as possible:

Environment details

  • OS type and version: Windows 11

  • Python version: python --version 3.11.9

  • pip version: pip --version 24.0

  • google-api-core version: pip show google-api-core 2.25.1

  • Dify version: v1.6.0

  • Dify Vertex AI Plugin version: 0.22.0

Steps to reproduce

  1. Set up Dify with Vertex AI with unsupport location (e.g. asia-southeast1), not
  2. Call Gemini 2.5 Pro in Workflow or Chatflow

Code example

N/A, I can only reproduce this error via Dify. But after I look at the source code, they call gemini though import vertexai.generative_models or from google import genai

Stack trace

Traceback (most recent call last):
  File "C:\Users\Alex.chim\AppData\Local\Programs\Python\Python311\Lib\site-packages\dify_plugin\core\server\io_server.py", line 92, in _execute_request_in_thread    
    self._execute_request(
  File "C:\Users\Alex.chim\AppData\Local\Programs\Python\Python311\Lib\site-packages\dify_plugin\plugin.py", line 337, in _execute_request
    for message in response:
  File "C:\Users\Alex.chim\AppData\Local\Programs\Python\Python311\Lib\site-packages\dify_plugin\interfaces\model\large_language_model.py", line 617, in invoke       
    yield from result
  File "C:\Users\Alex.chim\Documents\GitHub\dify-official-plugins\models\vertex_ai\models\llm\llm.py", line 619, in _handle_generate_stream_response
    for chunk in response:
  File "C:\Users\Alex.chim\AppData\Local\Programs\Python\Python311\Lib\site-packages\vertexai\generative_models\_generative_models.py", line 861, in _generate_content_streaming
    response_stream = self._prediction_client.stream_generate_content(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Alex.chim\AppData\Local\Programs\Python\Python311\Lib\site-packages\google\cloud\aiplatform_v1\services\prediction_service\client.py", line 2289, in stream_generate_content
    response = rpc(
               ^^^^
  File "C:\Users\Alex.chim\AppData\Local\Programs\Python\Python311\Lib\site-packages\google\api_core\gapic_v1\method.py", line 131, in __call__
    return wrapped_func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Alex.chim\AppData\Local\Programs\Python\Python311\Lib\site-packages\google\api_core\grpc_helpers.py", line 76, in error_remapped_callable
    return callable_(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Alex.chim\AppData\Local\Programs\Python\Python311\Lib\site-packages\google\cloud\aiplatform_v1\services\prediction_service\transports\rest.py", line 1555, in __call__
    raise core_exceptions.from_http_response(response)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Alex.chim\AppData\Local\Programs\Python\Python311\Lib\site-packages\google\api_core\exceptions.py", line 557, in from_http_response
    return format_http_response_error(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Alex.chim\AppData\Local\Programs\Python\Python311\Lib\site-packages\google\api_core\exceptions.py", line 517, in format_http_response_error
    error_message = payload.get("error", {}).get("message", "unknown error")
                    ^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'get'

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions