[问题/Issue] 章节8.1.4:Neo4j云服务不可用: Unable to retrieve routing information
documentation
### 1. 遇到问题的章节 / Affected Chapter
Chapter8.1.4
### 2. 问题类型 / Issue Type
其他 / Other
### 3. 具体问题描述 / Problem Description
运行8.1.4的demo时出现了ERROR:neo4j.pool:Unable to retrieve routing information
ERROR:hello_agents.memory.storage.neo4j_store:❌ Neo4j服务不可用: Unable to retrieve routing information的错误,我尝试了issue中的几种办法:
1、把from dotenv import load_dotenv
load_dotenv()提前;
2、把neo4j+s改为neo4j+ssc、bolt+;
3、修改database_config.py中Neo4jConfig.from_env的默认配置均无效。
### 4. 问题重现材料 / Reproduction Materials
D:\Anaconda3\envs\agent\python.exe D:\PycharmProjects\hello-agents\code\chapter8\FirstTest.py
[OK] SQLite 数据库表和索引创建完成
[OK] SQLite 文档存储初始化完成: ./memory_data\memory.db
INFO:hello_agents.memory.storage.qdrant_store:✅ 成功连接到Qdrant云服务: https://b7ac123a-cdc8-4a41-a7da-7f19245711eb.us-west-1-0.aws.cloud.qdrant.io
INFO:hello_agents.memory.storage.qdrant_store:✅ 使用现有Qdrant集合: hello_agents_vectors
INFO:hello_agents.memory.types.semantic:✅ 嵌入模型就绪,维度: 1024
INFO:hello_agents.memory.types.semantic:✅ Qdrant向量数据库初始化完成
ERROR:neo4j.pool:Unable to retrieve routing information
ERROR:hello_agents.memory.storage.neo4j_store:❌ Neo4j服务不可用: Unable to retrieve routing information
INFO:hello_agents.memory.storage.neo4j_store:💡 请检查URL和网络连接
ERROR:hello_agents.memory.types.semantic:❌ 数据库初始化失败: Unable to retrieve routing information
INFO:hello_agents.memory.types.semantic:💡 请检查数据库配置和网络连接
INFO:hello_agents.memory.types.semantic:💡 参考 DATABASE_SETUP_GUIDE.md 进行配置
Traceback (most recent call last):
File "D:\Anaconda3\envs\agent\lib\site-packages\neo4j\_async_compat\network\_bolt_socket.py", line 581, in _connect_secure
s = ssl_context.wrap_socket(s, server_hostname=sni_host)
File "D:\Anaconda3\envs\agent\lib\ssl.py", line 513, in wrap_socket
return self.sslsocket_class._create(
File "D:\Anaconda3\envs\agent\lib\ssl.py", line 1104, in _create
self.do_handshake()
File "D:\Anaconda3\envs\agent\lib\ssl.py", line 1375, in do_handshake
self._sslobj.do_handshake()
ConnectionResetError: [WinError 10054] 远程主机强迫关闭了一个现有的连接。
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\Anaconda3\envs\agent\lib\site-packages\neo4j\_sync\io\_bolt_socket.py", line 329, in connect
s = cls._connect_secure(
File "D:\Anaconda3\envs\agent\lib\site-packages\neo4j\_async_compat\network\_bolt_socket.py", line 594, in _connect_secure
raise BoltSecurityError(
neo4j._exceptions.BoltSecurityError: [ConnectionResetError] Connection Failed. Please ensure that your database is listening on the correct host and port and that you have enabled encryption if required. Note that the default encryption setting has changed in Neo4j 4.0. See the docs for more information. Failed to establish encrypted connection. (code 10054: Unknown error)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\Anaconda3\envs\agent\lib\site-packages\neo4j\_sync\io\_pool.py", line 833, in fetch_routing_table
new_routing_info = self.fetch_routing_info(
File "D:\Anaconda3\envs\agent\lib\site-packages\neo4j\_sync\io\_pool.py", line 792, in fetch_routing_info
cx = self._acquire(address, auth, deadline, None)
File "D:\Anaconda3\envs\agent\lib\site-packages\neo4j\_sync\io\_pool.py", line 418, in _acquire
return connection_creator()
File "D:\Anaconda3\envs\agent\lib\site-packages\neo4j\_sync\io\_pool.py", line 231, in connection_creator
connection = self.opener(
File "D:\Anaconda3\envs\agent\lib\site-packages\neo4j\_sync\io\_pool.py", line 711, in opener
return Bolt.open(
File "D:\Anaconda3\envs\agent\lib\site-packages\neo4j\_sync\io\_bolt.py", line 366, in open
s, protocol_version = BoltSocket.connect(
File "D:\Anaconda3\envs\agent\lib\site-packages\neo4j\_sync\io\_bolt_socket.py", line 380, in connect
raise ServiceUnavailable(
neo4j.exceptions.ServiceUnavailable: Couldn't connect to 34.126.161.242:7687 (resolved to ('34.126.161.242:7687',)):
[ConnectionResetError] Connection Failed. Please ensure that your database is listening on the correct host and port and that you have enabled encryption if required. Note that the default encryption setting has changed in Neo4j 4.0. See the docs for more information. Failed to establish encrypted connection. (code 10054: Unknown error)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\PycharmProjects\hello-agents\code\chapter8\FirstTest.py", line 37, in <module>
memory_tool = MemoryTool(user_id="user123")
File "D:\Anaconda3\envs\agent\lib\site-packages\hello_agents\tools\builtin\memory_tool.py", line 38, in __init__
self.memory_manager = MemoryManager(
File "D:\Anaconda3\envs\agent\lib\site-packages\hello_agents\memory\manager.py", line 51, in __init__
self.memory_types['semantic'] = SemanticMemory(self.config)
File "D:\Anaconda3\envs\agent\lib\site-packages\hello_agents\memory\types\semantic.py", line 108, in __init__
self._init_databases()
File "D:\Anaconda3\envs\agent\lib\site-packages\hello_agents\memory\types\semantic.py", line 155, in _init_databases
self.graph_store = Neo4jGraphStore(**neo4j_config)
File "D:\Anaconda3\envs\agent\lib\site-packages\hello_agents\memory\storage\neo4j_store.py", line 57, in __init__
self._initialize_driver(
File "D:\Anaconda3\envs\agent\lib\site-packages\hello_agents\memory\storage\neo4j_store.py", line 76, in _initialize_driver
self.driver.verify_connectivity()
File "D:\Anaconda3\envs\agent\lib\site-packages\neo4j\_sync\driver.py", line 1064, in verify_connectivity
self._get_server_info(session_config)
File "D:\Anaconda3\envs\agent\lib\site-packages\neo4j\_sync\driver.py", line 1293, in _get_server_info
return session._get_server_info()
File "D:\Anaconda3\envs\agent\lib\site-packages\neo4j\_sync\work\session.py", line 175, in _get_server_info
self._connect(
File "D:\Anaconda3\envs\agent\lib\site-packages\neo4j\_sync\work\session.py", line 128, in _connect
super()._connect(
File "D:\Anaconda3\envs\agent\lib\site-packages\neo4j\_sync\work\workspace.py", line 166, in _connect
target_db = self._get_routing_target_database(
File "D:\Anaconda3\envs\agent\lib\site-packages\neo4j\_sync\work\workspace.py", line 244, in _get_routing_target_database
self._pool.update_routing_table(
File "D:\Anaconda3\envs\agent\lib\site-packages\neo4j\_sync\io\_pool.py", line 1076, in update_routing_table
raise ServiceUnavailable(
neo4j.exceptions.ServiceUnavailable: Unable to retrieve routing information
进程已结束,退出代码为 1
### 5. 补充信息 / Additional Information
对应的使用版本如下:
hello-agents==0.2.0
torch==2.1.0
torchvision==0.16.0
torchaudio==2.1.0
torch==12.1
python==3.10.20
### 确认事项 / Verification
- [x] 我已阅读过相关章节的文档 / I have read the relevant chapter documentation
- [x] 我已搜索过现有的Issues,确认此问题未被报告 / I have searched existing Issues and confirmed this hasn't been reported
- [x] 我已尝试过基本的故障排除(如重启、重新安装依赖等) / I have tried basic troubleshooting (restart, reinstall dependencies, etc.)
关闭于 2026-06-12 13 条评论