#968 requests.exceptions.ConnectionError: HTTPConnectionPool(host='0.0.0.0', port=9874): Max retries exceeded with url: /tts?

112.241* Posted at: 7 hours ago 👁5

多次重试连接失败,请确保本地服务已正确启动:

Traceback (most recent call last):

File "urllib3\connection.py", line 198, in _new_conn

File "urllib3\util\connection.py", line 85, in create_connection

File "urllib3\util\connection.py", line 73, in create_connection

OSError: [WinError 10049] 在其上下文中,该请求的地址无效。

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File "urllib3\connectionpool.py", line 787, in urlopen

File "urllib3\connectionpool.py", line 493, in _make_request

File "urllib3\connection.py", line 494, in request

File "http\client.py", line 1277, in endheaders

File "http\client.py", line 1037, in _send_output

File "http\client.py", line 975, in send

File "urllib3\connection.py", line 325, in connect

File "urllib3\connection.py", line 213, in _new_conn

urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [WinError 10049] 在其上下文中,该请求的地址无效。

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File "requests\adapters.py", line 667, in send

File "urllib3\connectionpool.py", line 841, in urlopen

File "urllib3\util\retry.py", line 519, in increment

urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='0.0.0.0', port=9874): Max retries exceeded with url: /tts?text=%E4%BD%A0%E5%A5%BD%E5%95%8A%2C%E6%88%91%E4%BA%B2%E7%88%B1%E7%9A%84%E6%9C%8B%E5%8F%8B%2C%E5%B8%8C%E6%9C%9B%E4%BD%A0%E7%9A%84%E6%AF%8F%E4%B8%80%E5%A4%A9%E9%83%BD%E6%98%AF%E7%BE%8E%E5%A5%BD%E6%84%89%E5%BF%AB%E7%9A%84%21&text_lang=zh&ref_audio_path=duteng01.wav&prompt_text=good+person+that+I+really+am+and+the+good+that+I+see.&prompt_lang=en&speed_factor=1.0 (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10049] 在其上下文中,该请求的地址无效。'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "videotrans\util\ListenVoice.py", line 18, in run

File "videotrans\tts\__init__.py", line 266, in run

File "videotrans\tts\_base.py", line 182, in run

File "videotrans\tts\_gptsovits.py", line 115, in _item_task

File "tenacity\__init__.py", line 338, in wrapped_f

File "tenacity\__init__.py", line 477, in __call__

File "tenacity\__init__.py", line 378, in iter

File "tenacity\__init__.py", line 400, in

File "concurrent\futures\_base.py", line 439, in result

File "concurrent\futures\_base.py", line 391, in __get_result

File "tenacity\__init__.py", line 480, in __call__

File "videotrans\tts\_gptsovits.py", line 92, in _run

File "requests\api.py", line 73, in get

File "requests\api.py", line 59, in request

File "requests\sessions.py", line 589, in request

File "requests\sessions.py", line 703, in send

File "requests\adapters.py", line 700, in send

requests.exceptions.ConnectionError: HTTPConnectionPool(host='0.0.0.0', port=9874): Max retries exceeded with url: /tts?text=%E4%BD%A0%E5%A5%BD%E5%95%8A%2C%E6%88%91%E4%BA%B2%E7%88%B1%E7%9A%84%E6%9C%8B%E5%8F%8B%2C%E5%B8%8C%E6%9C%9B%E4%BD%A0%E7%9A%84%E6%AF%8F%E4%B8%80%E5%A4%A9%E9%83%BD%E6%98%AF%E7%BE%8E%E5%A5%BD%E6%84%89%E5%BF%AB%E7%9A%84%21&text_lang=zh&ref_audio_path=duteng01.wav&prompt_text=good+person+that+I+really+am+and+the+good+that+I+see.&prompt_lang=en&speed_factor=1.0 (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10049] 在其上下文中,该请求的地址无效。'))

=====

Windows-10-10.0.26200-SP0

version:v3.81

frozen:True

language:zh

1 Replies

本条内容由 gpt-5-mini 回复
核心原因:客户端在请求本地 TTS 时使用了 0.0.0.0:9874 作为目标地址,Windows 不允许用 0.0.0.0 作为远程连接目标(会报 WinError 10049),或本地 TTS 服务未在该端口/地址启动,因此连接失败。核心修复办法是把客户端目标改为 127.0.0.1/localhost 并确保本地服务在该端口监听,或启动/放行对应的本地 TTS 服务。

请按下面步骤排查并修复:

1. 检查并修改软件中的 TTS 地址设置

  • 打开 菜单 -> 翻译设置 / TTS 设置,找到本地 TTS 的“主机/地址”和“端口”配置。
  • 如果地址是 0.0.0.0,改为 127.0.0.1 或 localhost,端口保留 9874(即 http://127.0.0.1:9874)。
  • 保存后重启 pyVideoTrans 再试一次。

2. 确认本地 TTS 服务已启动并监听正确地址/端口

  • 如果你使用本地 TTS(如 gpt-sovits / 本地模型等),先按该模型的启动命令启动服务(启动后应在本机某端口监听)。
  • 在 Windows 命令行运行:netstat -ano | findstr 9874
  • 期望看到类似 127.0.0.1:9874 LISTENING(如果只看到 0.0.0.0:9874,说明服务在所有接口监听,但客户端仍应用本机 IP/127.0.0.1 连接)。
  • 或在浏览器/命令行用 http://127.0.0.1:9874 进行简单访问测试,看是否有响应。

3. 防火墙与安全软件

  • 若服务已启动但仍连不上,检查 Windows 防火墙或杀毒软件是否阻止了该端口。可临时关闭防火墙或为该端口添加允许规则进行测试。

4. 关于 0.0.0.0 的说明(避免误操作)

  • 0.0.0.0 是服务器绑定地址(表示所有接口),不是用作客户端连接目标。客户端不应配置为 0.0.0.0,应该使用 127.0.0.1 或机器的实际 IP(例如 192.168.x.x)。

5. 如果仍无法解决,请提供更多信息

  • 把最近一次运行时的日志文件(位于 软件根目录/videotrans/logs/,例如 YYYYMMDD.log)贴上来,或把你在 TTS 设置中的“配音渠道”和“本地地址”截图/配置文本一并提供。我会基于日志进一步定位原因。

补充提示:Traceback 中涉及 videotrans/tts/_gptsovits.py,说明是调用本地 gptsovits 类服务时出错;优先检查该本地服务是否已按对应模型的启动方法运行并监听 127.0.0.1:9874。

Post Your Reply
Open source and free maintenance is not easy. If this project is helpful to you, please consider making a small donation to help the project continue to maintain and update.

Donate: https://ko-fi.com/jianchang512

Similar issues already exist

Trending Questions