[Bug] macOS 环境下配置 DeepSeek API 测试连接报错:connect: bad file descriptor
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 4.4k
- Forks
- 248
- PR merge metrics
- No merged PRs in 30d
Description
系统环境
操作系统:macOS (版本号26.5.2 (25F84))
TscanPlus 版本:( v3.3.9)
芯片架构:(ARM)
🐞 问题描述
在 TscanPlus 的 AI 模块配置中接入 DeepSeek 大模型时,无论使用 deepseek-chat 还是 deepseek-v4-flash 模型,点击“测试模型”始终返回错误:
text
[ERROR] DeepSeek 模型测试异常: ERROR: 发送请求失败: Post "https://api.deepseek.com/v1/chat/completions": dial tcp 182.247.248.128:443: connect: bad file descriptor
关键矛盾点:使用系统终端 curl 命令调用完全相同的 API 地址和密钥,可以成功返回 HTTP 200 及正常响应。这说明 系统网络、DNS 解析、防火墙以及 DeepSeek 服务端均无任何问题。
🔄 复现步骤
打开 TscanPlus,进入 AI 模型配置界面。
提供商选择 DeepSeek。
API 地址填写:https://api.deepseek.com/v1/chat/completions。
填写有效的 API 密钥,模型选择 deepseek-v4-flash。
点击“确定”保存,随后执行“测试模型”或直接使用 AI 功能。
📋 实际结果
程序报错 bad file descriptor,连接失败。
(附上截图:配置界面和错误弹窗)
✅ 预期结果
应正常返回 AI 响应内容(如 Hello! How can I help you?)。
🧪 额外排查信息(证明环境正常)
我已确认以下外部因素无异常:
本地网络权限:已在 系统设置 -> 隐私与安全性 -> 本地网络 中开启 TscanPlus 权限。
代理/VPN:已确认系统代理关闭,无 VPN 运行。
DNS 解析:正常解析到 DeepSeek CDN IP(如 182.247.248.128)。
Curl 验证(成功):
bash
curl -v https://api.deepseek.com/v1/chat/completions
-H "Content-Type: application/json"
-H "Authorization: Bearer API-KEY"
-d '{"model":"deepseek-v4-flash","messages":[{"role":"user","content":"hi"}]}'
(返回 HTTP/2 200,完整响应体略)
💡 可能的分析建议
该报错在 Go 语言的 net.Dial 中常由连接池复用异常或未关闭的残留 socket 引起,可能与 macOS 的网络扩展(如 utun 虚拟网卡残留)或特定的 TCP 端口复用机制有关。
[ERROR] DeepSeek 模型测试异常: ERROR: 发送请求失败: Post "https://api.deepseek.com/v1/chat/completions": dial tcp 171.105.220.186:443: connect: bad file descriptor
[INFO] 开始测试模型: DeepSeek - deepseek-v4-flash
[INFO] AI模块初始化完成
[SUCCESS] 模型配置加载成功
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the DeepSeek model test on macOS ARM with the reported endpoint, then trace the TscanPlus AI module's Go request path through net.Dial and compare it with the successful curl request. Done means the in-app model test returns a normal AI response instead of "connect: bad file descriptor".
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100