Skip to content
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

Connect to OpenAI failes: requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) #155

Open
StL-Jim opened this issue Apr 7, 2024 · 2 comments

Comments

@StL-Jim
Copy link

StL-Jim commented Apr 7, 2024

Briefly describe your issue

Start script
from voyager import Voyager

openai_api_key = "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" # not a real key
voyager = Voyager(
mc_port=55555,
openai_api_key=openai_api_key,
)
voyager.learn()


Console logs
~/git/Voyager$ python ./voyager_sandbox.py
Mineflayer process has exited, restarting
Subprocess mineflayer started with PID 10170.
Server started on port 3000

Traceback (most recent call last):
File "/home/jimm/git/privateGPT/lib/python3.10/site-packages/urllib3/connectionpool.py", line 790, in urlopen
response = self._make_request(
File "/home/jimm/git/privateGPT/lib/python3.10/site-packages/urllib3/connectionpool.py", line 536, in _make_request
response = conn.getresponse()
File "/home/jimm/git/privateGPT/lib/python3.10/site-packages/urllib3/connection.py", line 454, in getresponse
httplib_response = super().getresponse()
File "/usr/lib/python3.10/http/client.py", line 1375, in getresponse
response.begin()
File "/usr/lib/python3.10/http/client.py", line 318, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.10/http/client.py", line 287, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/jimm/git/privateGPT/lib/python3.10/site-packages/requests/adapters.py", line 486, in send
resp = conn.urlopen(
File "/home/jimm/git/privateGPT/lib/python3.10/site-packages/urllib3/connectionpool.py", line 844, in urlopen
retries = retries.increment(
File "/home/jimm/git/privateGPT/lib/python3.10/site-packages/urllib3/util/retry.py", line 470, in increment
raise reraise(type(error), error, _stacktrace)
File "/home/jimm/git/privateGPT/lib/python3.10/site-packages/urllib3/util/util.py", line 38, in reraise
raise value.with_traceback(tb)
File "/home/jimm/git/privateGPT/lib/python3.10/site-packages/urllib3/connectionpool.py", line 790, in urlopen
response = self._make_request(
File "/home/jimm/git/privateGPT/lib/python3.10/site-packages/urllib3/connectionpool.py", line 536, in _make_request
response = conn.getresponse()
File "/home/jimm/git/privateGPT/lib/python3.10/site-packages/urllib3/connection.py", line 454, in getresponse
httplib_response = super().getresponse()
File "/usr/lib/python3.10/http/client.py", line 1375, in getresponse
response.begin()
File "/usr/lib/python3.10/http/client.py", line 318, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.10/http/client.py", line 287, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/foo/git/Voyager/voyager_sandbox.py", line 17, in
voyager.learn()
File "/home/foo/git/Voyager/voyager/voyager.py", line 306, in learn
self.env.reset(
File "/home/foo/git/Voyager/voyager/env/bridge.py", line 156, in reset
returned_data = self.check_process()
File "/home/foo/git/Voyager/voyager/env/bridge.py", line 93, in check_process
res = requests.post(
File "/home/foo/.local/lib/python3.10/site-packages/requests/api.py", line 115, in post
return request("post", url, data=data, json=json, **kwargs)
File "/home/foo/.local/lib/python3.10/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "/home/foo/.local/lib/python3.10/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "/home/foo/.local/lib/python3.10/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "/home/foo/.local/lib/python3.10/site-packages/requests/adapters.py", line 501, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

Please provide your python, nodejs, Minecraft, and Fabric versions here

Linux Mint 21
Python 3.10.12
Node.js v20.12.1

Minecraft 1.19.3
Fabric version 0.14.18

[If applicable] Please provide the Minefalyer and Minecraft logs, you can find the log under logs folder

2024-04-06 22:12:35,654 - mineflayer - INFO - Stopping subprocess.
2024-04-06 22:12:36,655 - mineflayer - INFO - Starting subprocess with commands: ['node', '/home/foo/git/Voyager/voyager/env/mineflayer/index.js', '3000']
2024-04-06 22:12:37,220 - mineflayer - INFO - Server started on port 3000
2024-04-06 22:12:37,220 - mineflayer - INFO - Subprocess is ready.
2024-04-06 22:12:37,240 - mineflayer - INFO - {
2024-04-06 22:12:37,240 - mineflayer - INFO - port: 55555,
2024-04-06 22:12:37,241 - mineflayer - INFO - reset: 'hard',
2024-04-06 22:12:37,241 - mineflayer - INFO - inventory: {},
2024-04-06 22:12:37,241 - mineflayer - INFO - equipment: [],
2024-04-06 22:12:37,241 - mineflayer - INFO - spread: false,
2024-04-06 22:12:37,241 - mineflayer - INFO - waitTicks: 20,
2024-04-06 22:12:37,241 - mineflayer - INFO - position: null
2024-04-06 22:12:37,241 - mineflayer - INFO - }
2024-04-06 22:12:40,716 - mineflayer - INFO - Mineflayer detected that you are using a deprecated event (physicTick)! Please use this event (physicsTick) instead.
2024-04-06 22:12:40,741 - mineflayer - INFO - node:internal/process/promises:289
2024-04-06 22:12:40,741 - mineflayer - INFO - triggerUncaughtException(err, true /* fromPromise */);
2024-04-06 22:12:40,741 - mineflayer - INFO - ^
2024-04-06 22:12:40,741 - mineflayer - INFO -
2024-04-06 22:12:40,741 - mineflayer - INFO - AssertionError [ERR_ASSERTION]: plugin needs to be a function
2024-04-06 22:12:40,742 - mineflayer - INFO - at EventEmitter.loadPlugin (/home/foo/git/Voyager/voyager/env/mineflayer/node_modules/mineflayer/lib/plugin_loader.js:16:12)
2024-04-06 22:12:40,742 - mineflayer - INFO - at EventEmitter. (/home/foo/git/Voyager/voyager/env/mineflayer/index.js:107:13)
2024-04-06 22:12:40,742 - mineflayer - INFO - at Object.onceWrapper (node:events:632:28)
2024-04-06 22:12:40,742 - mineflayer - INFO - at EventEmitter.emit (node:events:530:35)
2024-04-06 22:12:40,742 - mineflayer - INFO - at Client. (/home/foo/git/Voyager/voyager/env/mineflayer/node_modules/mineflayer/lib/plugins/health.js:31:11)
2024-04-06 22:12:40,742 - mineflayer - INFO - at Client.emit (node:events:518:28)
2024-04-06 22:12:40,742 - mineflayer - INFO - at emitPacket (/home/foo/git/Voyager/voyager/env/mineflayer/node_modules/minecraft-protocol/src/client.js:83:12)
2024-04-06 22:12:40,742 - mineflayer - INFO - at FullPacketParser. (/home/foo/git/Voyager/voyager/env/mineflayer/node_modules/minecraft-protocol/src/client.js:112:9)
2024-04-06 22:12:40,742 - mineflayer - INFO - at FullPacketParser.emit (node:events:518:28)
2024-04-06 22:12:40,742 - mineflayer - INFO - at addChunk (/home/foo/git/Voyager/voyager/env/mineflayer/node_modules/protodef/node_modules/readable-stream/lib/_stream_readable.js:279:12) {
2024-04-06 22:12:40,743 - mineflayer - INFO - generatedMessage: false,
2024-04-06 22:12:40,743 - mineflayer - INFO - code: 'ERR_ASSERTION',
2024-04-06 22:12:40,743 - mineflayer - INFO - actual: false,
2024-04-06 22:12:40,743 - mineflayer - INFO - expected: true,
2024-04-06 22:12:40,743 - mineflayer - INFO - operator: '=='
2024-04-06 22:12:40,743 - mineflayer - INFO - }
2024-04-06 22:12:40,743 - mineflayer - INFO -
2024-04-06 22:12:40,743 - mineflayer - INFO - Node.js v20.12.1

[If applicable] Please provide the GPT conversations that are printed each round.

none

Verified OPENAI_API_KEY works using OpenAI example for testing

Copy link

github-actions bot commented May 8, 2024

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label May 8, 2024
@joshuademarco
Copy link

joshuademarco commented May 9, 2024

I have encountered the same issues. When looking at the logs you will notice that it is related to #148
Just follow the solution by @dawn0815 and un-/comment the mentioned lines.

@github-actions github-actions bot removed the stale label May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants