Debugging '"response_data": "An error occurred while executing the plugin."'

I’m trying to set up an action for a GPT that keeps failing. I’ve tested the API endpoint on Postman and manually with the function below, so I’m not sure what’s causing it to fail. Can anyone help?

Here’s an example function that shows what the action should be doing:

import requests

def get_project_details(project_id):
    # API endpoint URL
    url = 'http://search.worldbank.org/api/v2/projects'

    # Parameters
    params = {
        'fl': '*',  # Fetches all fields
        'id': project_id
    }

    # Sending GET request
    response = requests.get(url, params=params)

    # Check if the request was successful
    if response.status_code == 200:
        return response.json()
    else:
        return f'Error: {response.status_code}, {response.text}'

# Testing the function with the specified project ID
project_details = get_project_details('P176418')
print(project_details)

Here’s the OpenAPI schema that should be initiating the action:

{
    "openapi": "3.1.0",
    "info": {
        "title": "World Bank Projects API",
        "description": "Provides access to World Bank project data, including project details, status, and other relevant information.",
        "version": "1.0.0"
    },
    "servers": [
        {
        "url": "https://search.worldbank.org"
        }
    ],
    "paths": {
        "/api/v2/projects": {
        "get": {
            "summary": "Retrieve project information",
            "operationId": "ProjectInfo",
            "parameters": [
            {
                "name": "fl",
                "in": "query",
                "description": "Fields list specifier, use '*' for all fields",
                "required": false,
                "schema": {
                "type": "string"
                }
            },
            {
                "name": "id",
                "in": "query",
                "description": "Project identifier",
                "required": false,
                "schema": {
                "type": "string"
                }
            }
            ]
        }
        }
    },
    "components": {
        "schemas": {
        }
    }
}

And here is the log for the error that I’m receiving when I try to initiate the action:
[debug] Calling HTTP endpoint

{
  "domain": "search.worldbank.org",
  "method": "get",
  "path": "/api/v2/projects",
  "operation": "ProjectInfo",
  "operation_hash": "602fd5328db1d60d4f814ebe49157b4752051ff5",
  "is_consequential": false,
  "params": {
    "fl": "*"
  }
}

[debug] Response received

{
  "response_data": "An error occurred while executing the plugin."
}

Two potential causes:

  1. Check API Endpoint and Method Consistency: Ensure that the API endpoint and method (GET) in your action setup match the working function you’ve tested. The function uses http://search.worldbank.org/api/v2/projects, but the OpenAPI schema mentions https://search.worldbank.org. The difference between http and https can be crucial.
  2. Inspect Parameter Handling: Your function successfully uses the fl and id parameters. In the action log, only fl is passed. Make sure the action is correctly configured to accept and pass the id parameter as required by the API.

More detail in this response from Full Stack Developer GPT.

1 Like

It can also be that your plugin api took too long and timed out.

Hello @goo is there a way we can deal with long requests?

What do you mean by long requests? Request size too long or request takes too long? Or response size too long?

Thank you for your prompt response.

If the request takes too long. Could that be the cause of this? And if yes, then what we can do about it?