官Q发图错误(不急到是不是插件的问题)

在使用ba-plugin发送模拟抽卡图片以及活动日程时出现了如下报错,然而抽漫画与关卡指令却可以正确发送图片
补充:沙盒可以正常发送

session Error: Bad Request
at [cordis.invoke] (/koishi/node_modules/@cordisjs/plugin-http/lib/index.cjs:340:23)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async [as sendFileGuild] (/koishi/node_modules/@satorijs/adapter-qq/lib/index.cjs:595:32)
at async QQMessageEncoder.sendFile (/koishi/node_modules/@satorijs/adapter-qq/lib/index.cjs:1075:15)
at async QQMessageEncoder.visit (/koishi/node_modules/@satorijs/adapter-qq/lib/index.cjs:1134:20)
at async QQMessageEncoder.render (/koishi/node_modules/@satorijs/core/lib/index.cjs:729:7)
at async QQMessageEncoder.send (/koishi/node_modules/@satorijs/core/lib/index.cjs:755:5)
at async Proxy.sendMessage (/koishi/node_modules/@satorijs/core/lib/index.cjs:486:22)
at async /koishi/node_modules/@koishijs/core/lib/index.cjs:2068:7
at async Proxy.withScope (/koishi/node_modules/@koishijs/core/lib/index.cjs:1975:22)

2 个赞

建议先检查图片链接是否可用,其次检查网络带宽,上行是否够用

这个错误往往是腾讯限制上传时间导致的


你在koishi沙盒是不可能复现的


插件按理来说没问题

AL1S类机器人使用的就是ba-plugin

而且也经常看见不同插件发送的此类bad request日志


2 个赞

可恶的腾讯居然限制这点上传时间,服务器是华为2核2g2m,可能确实是因为上行有点慢导致的(

2 个赞

我这里遇到的 bad request 一般是这样:

其中 请求数据过大,读取超时 一般就是因为上传超时了

请求数据过大,读取超时

图片过大,没有完整上传成功


{ response: { data: { message: '请求数据过大,读取超时', code: 10998, err_code: 40011024, trace_id: '6b21275a44c51d2cfeb2733bae86160a' }, url: 'https://api.sgroup.qq.com/channels/***********/messages', status: 400, statusText: 'Bad Request', headers: Headers { date: 'Wed, 05 Feb 2025 06:37:41 GMT', 'content-type': 'application/json', 'content-length': '126', connection: 'keep-alive', 'x-tps-trace-id': '6b21275a44c51d2cfeb2733bae86160a', 'access-control-allow-credentials': 'true', 'access-control-allow-methods': 'GET, POST, OPTIONS', 'access-control-allow-headers': 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,authorization' } }, code: undefined, [Symbol(cordis.http.error)]: true }

消息发送失败,机器人非群成员

{ response: { data: { message: '消息发送失败,机器人非群成员', code: 11293, err_code: 40034101, trace_id: 'b9fd6e2c5c5a03379dfd91fb1a5e58fd' }, url: 'https://api.sgroup.qq.com/v2/groups/9DC3F2E1560249FDF8DED212A46FA42C/messages', status: 400, statusText: 'Bad Request', headers: Headers { date: 'Tue, 11 Feb 2025 09:20:08 GMT', 'content-type': 'application/json', 'content-length': '135', connection: 'keep-alive', 'x-tps-trace-id': 'b9fd6e2c5c5a03379dfd91fb1a5e58fd', 'access-control-allow-credentials': 'true', 'access-control-allow-methods': 'GET, POST, OPTIONS', 'access-control-allow-headers': 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,authorization' } }, code: undefined, [Symbol(cordis.http.error)]: true }

在我这里,Internal Server Error 更为常见

msg repeated

消息重复了


{ response: { data: { code: 1100000, message: 'msg repeated', err_code: 1100000, trace_id: 'bc04a502f505e1187c7de8344ec60fbd' }, url: 'https://api.sgroup.qq.com/channels/***********/messages', status: 500, statusText: 'Internal Server Error', headers: Headers { date: 'Wed, 05 Feb 2025 07:09:30 GMT', 'content-type': 'application/json', 'content-length': '106', connection: 'keep-alive', 'x-content-type-options': 'nosniff', 'x-tps-trace-id': 'bc04a502f505e1187c7de8344ec60fbd', 'access-control-allow-credentials': 'true', 'access-control-allow-methods': 'GET, POST, OPTIONS', 'access-control-allow-headers': 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,authorization' } }, code: undefined, [Symbol(cordis.http.error)]: true }

type:business, code:4, msg:null

发消息频率太高了?


{ response: { data: { code: 2000000, message: 'type:business, code:4, msg:null', err_code: 2000000, trace_id: '5193fb02c725a995ba40efa01af18362' }, url: 'https://api.sgroup.qq.com/channels/***********/messages', status: 500, statusText: 'Internal Server Error', headers: Headers { date: 'Wed, 05 Feb 2025 07:08:51 GMT', 'content-type': 'application/json', 'content-length': '125', connection: 'keep-alive', 'x-content-type-options': 'nosniff', 'x-tps-trace-id': '5193fb02c725a995ba40efa01af18362', 'access-control-allow-credentials': 'true', 'access-control-allow-methods': 'GET, POST, OPTIONS', 'access-control-allow-headers': 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,authorization' } }, code: undefined, [Symbol(cordis.http.error)]: true }

file size exceeded

图片文件过大,可能是抽到了10MB这样的图?

{ response: { data: { message: 'file size exceeded', code: 304020, err_code: 304020, trace_id: '6b48b4a1c84ad594f7b8ae1817acbe2a' }, url: 'https://api.sgroup.qq.com/channels/************/messages', status: 500, statusText: 'Internal Server Error', headers: Headers { date: 'Fri, 07 Feb 2025 17:43:14 GMT', 'content-type': 'application/json', 'content-length': '110', connection: 'keep-alive', 'x-tps-trace-id': '6b48b4a1c84ad594f7b8ae1817acbe2a', 'access-control-allow-credentials': 'true', 'access-control-allow-methods': 'GET, POST, OPTIONS', 'access-control-allow-headers': 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,authorization' } }, code: undefined, [Symbol(cordis.http.error)]: true }

1 个赞