request to https://catiecli.sukaka.top/build-proxy/v1/models failed, reason: sel...
错误信息
Instantiated the tokenizer for gemma
FetchError: request to https://catiecli.sukaka.top/build-proxy/v1/models failed, reason: self-signed certificate
at ClientRequest.<anonymous> (file:///C:/sillytavern1/SillyTavern/node_modules/node-fetch/src/index.js:108:11)
at ClientRequest.emit (node:events:524:28)
at emitErrorEvent (node:_http_client:104:11)
at TLSSocket.socketErrorListener (node:_http_client:518:5)
at TLSSocket.emit (node:events:524:28)
at emitErrorNT (node:internal/streams/destroy:170:8)
at emitErrorCloseNT (node:internal/streams/destroy:129:3)
at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
type: 'system',
errno: 'DEPTH_ZERO_SELF_SIGNED_CERT',
code: 'DEPTH_ZERO_SELF_SIGNED_CERT',
erroredSysCall: undefined
}
AI 解决方案
🌐 错误翻译
原文:FetchError: request to https://catiecli.sukaka.top/build-proxy/v1/models failed, reason: self-signed certificate
译文:FetchError:请求 https://catiecli.sukaka.top/build-proxy/v1/models 失败,原因:自签名证书
🎯 原因分析
该错误是由于应用程序尝试访问 HTTPS 接口,但目标服务器使用的是自签名证书,系统无法验证该证书的有效性,导致 SSL 连接握手失败。
错误类型 DEPTH_ZERO_SELF_SIGNED_CERT 明确表示遇到了无法信任的证书链。
💡 解决方案
如果是本地开发或测试环境,可以暂时禁用 SSL 严格验证:
// 方案1:使用 node-fetch 的配置(如果您能控制代码)
const fetch = require('node-fetch');
const agent = new (require('https')).Agent({
rejectUnauthorized: false, // 不验证证书安全性
});
fetch(url, { agent })
.then(res => res.json())
.catch(err => console.error(err));
// 方案2:在全局环境变量中设置(Node.js 启动前)
// Windows PowerShell
$env:NODE_TLS_REJECT_UNAUTHORIZED = "0"
// Linux / macOS
export NODE_TLS_REJECT_UNAUTHORIZED=0
# 方案3:PowerShell 临时绕过
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12
$env:NODE_TLS_REJECT_UNAUTHORIZED = "0"
🛡️ 预防措施
- 🔐 生产环境严禁禁用证书验证:上述方案仅限开发环境使用,正式部署必须使用受信任 CA 签发的证书
- 🔧 工具推荐:使用
curl -v URL测试目标接口,可快速诊断是网络问题还是证书问题;建议使用openssl s_client -connect HOST:PORT检查证书详情