AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

Google search fails with 400 Bad request: Request contains an invalid argument

Open Monjai95xd opened this issue 2 years ago • 4 comments

⚠️ Search for existing issues first ⚠️

  • [X] I have searched the existing issues, and there is no existing issue for my problem

GPT-3 or GPT-4

  • [X] I am using Auto-GPT with GPT-3 (GPT-3.5)

Steps to reproduce 🕹

Each time when Auto-GPT try to google something, it return the same message like this. How to solve it? T^T

SYSTEM: Command google returned: Error: <HttpError 400 when requesting https://customsearch.googleapis.com/customsearch/v1?q=top+5+social+media+platforms+2023%3B+5+emerging+social+media+platforms+2023&cx=autogpt-383613&num=8&key=AIzaSyDOf6f0U-erJubJjHFA1-KmmT97T720Z8Y&alt=json returned "Request contains an invalid argument.". Details: "[{'message': 'Request contains an invalid argument.', 'domain': 'global', 'reason': 'badRequest'}]">

Current behavior 😯

No response

Expected behavior 🤔

No response

Your prompt 📝

# Paste your prompt here

Monjai95xd avatar Apr 18 '23 07:04 Monjai95xd

First, go cycle your api key

Second, verify your api key is in the right format

ntindle avatar Apr 18 '23 08:04 ntindle

Exactly error of a wrong api key. Had the same issuu.

horazius avatar Apr 18 '23 21:04 horazius

I have the same error, but only when I switch to 'stable' branch if I use 'master' it return the list of result but in master I have error ref: #1407

thewasta avatar Apr 20 '23 13:04 thewasta

have you solved this problem? I have checked my key and id. Is there special url to check or some tutorials?

LeiyanGithub avatar Apr 24 '23 13:04 LeiyanGithub

In my case... Im working in "stable" branch and fixed it by editing autogpt/commands/google_search.py, you must to compare it with master branch, add the method and line which are diff.

# stable branch

def google_search(query):
 ...
  return json.dumps(search_results, ensure_ascii=False, indent=4)

But master has the method safe_google_results(results)

So you have to add this method and change the return of method. Hope you fix it!

thewasta avatar Apr 27 '23 00:04 thewasta

For me, what worked was creating a custom search engine from https://programmablesearchengine.google.com/controlpanel/all and making it "Search the entire web". I added the ID of the custom search engine to .env. It started working

dushshantha avatar Jun 02 '23 00:06 dushshantha

This issue has automatically been marked as stale because it has not had any activity in the last 50 days. You can unstale it by commenting or removing the label. Otherwise, this issue will be closed in 10 days.

github-actions[bot] avatar Sep 06 '23 21:09 github-actions[bot]

This issue was closed automatically because it has been stale for 10 days with no activity.

github-actions[bot] avatar Sep 17 '23 01:09 github-actions[bot]