Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] 多数图片出现“文件下载失败”报错,导致无法进行后续命令 #67

Closed
CCzer opened this issue Jun 13, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@CCzer
Copy link

CCzer commented Jun 13, 2024

系统版本

ubuntu 22.04

QQNT 版本

Linux 3.2.7-23361

NapCat 版本

v1.5.5

OneBot 客户端

nonebot2框架最新release

发生了什么?

在命令传输图片的时候,约50%图片会报错“文件下载失败”,具体log可见下方贴的log,出问题时手动检查过该图片url可以正常下载。
已尝试使用正向ws和反向ws两种通信,均有问题。

如何复现

直接在用onebot.v11适配器,调用Message函数创建一个新的图片对象,图片来源为上一个接收到的图片消息,将构建的图片消息发送出去,即可复现

期望的结果?

正常传输图片

NapCat 运行日志

ActionFailed(status='failed', retcode=1200, data=None, message='Error: 文件下载失败https://multimedia.nt.qq.com.cn/download?appid=1407&fileid=CgoxMDM2NTQ4Mjg5EhTqmB6hGaTATy5-46gHwU9sbrRJWRiY_wog_woo14mc-L7XhgNQgL2jAQ&spec=0&rkey=CAQSKAB6JWENi5LMJ35q_dd2VPeEkT1m3OlV1bHcyvqr1H3gOO42ASpw-Kg下载失败,Error: 下载文件失败: Bad Request\n    at Object.UZKRT (file:///home/kuroa/napcatqq/NapCat.linux.x64/napcat.mjs:21431:2953)\n    at handleOb11FileLikeMessage (file:///home/kuroa/napcatqq/NapCat.linux.x64/napcat.mjs:21431:6494)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async Object.image (file:///home/kuroa/napcatqq/NapCat.linux.x64/napcat.mjs:21431:10888)\n    at async createSendElements (file:///home/kuroa/napcatqq/NapCat.linux.x64/napcat.mjs:21431:16387)\n    at async SendGroupMsg._handle (file:///home/kuroa/napcatqq/NapCat.linux.x64/napcat.mjs:21435:11342)\n    at async SendGroupMsg.websocketHandle (file:///home/kuroa/napcatqq/NapCat.linux.x64/napcat.mjs:21427:7326)\n    at async ReverseWebsocket.onmessage (file:///home/kuroa/napcatqq/NapCat.linux.x64/napcat.mjs:22072:8875)\n    at async WebSocket.<anonymous> (file:///home/kuroa/napcatqq/NapCat.linux.x64/napcat.mjs:22072:12625)', wording='Error: 文件下载失败https://multimedia.nt.qq.com.cn/download?appid=1407&fileid=CgoxMDM2NTQ4Mjg5EhTqmB6hGaTATy5-46gHwU9sbrRJWRiY_wog_woo14mc-L7XhgNQgL2jAQ&spec=0&rkey=CAQSKAB6JWENi5LMJ35q_dd2VPeEkT1m3OlV1bHcyvqr1H3gOO42ASpw-Kg下载失败,Error: 下载文件失败: Bad Request\n    at Object.UZKRT (file:///home/kuroa/napcatqq/NapCat.linux.x64/napcat.mjs:21431:2953)\n    at handleOb11FileLikeMessage (file:///home/kuroa/napcatqq/NapCat.linux.x64/napcat.mjs:21431:6494)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async Object.image (file:///home/kuroa/napcatqq/NapCat.linux.x64/napcat.mjs:21431:10888)\n    at async createSendElements (file:///home/kuroa/napcatqq/NapCat.linux.x64/napcat.mjs:21431:16387)\n    at async SendGroupMsg._handle (file:///home/kuroa/napcatqq/NapCat.linux.x64/napcat.mjs:21435:11342)\n    at async SendGroupMsg.websocketHandle (file:///home/kuroa/napcatqq/NapCat.linux.x64/napcat.mjs:21427:7326)\n    at async ReverseWebsocket.onmessage (file:///home/kuroa/napcatqq/NapCat.linux.x64/napcat.mjs:22072:8875)\n    at async WebSocket.<anonymous> (file:///home/kuroa/napcatqq/NapCat.linux.x64/napcat.mjs:22072:12625)', echo='20')

OneBot 客户端运行日志

File "/home/kuroa/asaki/plugins/nonebot_plugin_antirecall/__init__.py", line 214, in recall_handle
    await bot.send_group_msg(group_id = gid, message = msg)
  File "/home/kuroa/.local/lib/python3.11/site-packages/nonebot/internal/adapter/bot.py", line 122, in call_api
    raise exception
  File "/home/kuroa/.local/lib/python3.11/site-packages/nonebot/internal/adapter/bot.py", line 97, in call_api
    result = await self.adapter._call_api(self, api, **data)
  File "/home/kuroa/.local/lib/python3.11/site-packages/nonebot/adapters/onebot/v11/adapter.py", line 147, in _call_api
    return handle_api_result(await self._result_store.fetch(seq, timeout))
  File "/home/kuroa/.local/lib/python3.11/site-packages/nonebot/adapters/onebot/v11/utils.py", line 58, in handle_api_result
    raise ActionFailed(**result)
@CCzer CCzer added the bug Something isn't working label Jun 13, 2024
@MliKiowa
Copy link
Member

可以尝试自己下载 然后再发送 QQ自己的证书好像有点问题

@MliKiowa
Copy link
Member

如果仍然有问题请再reopen

@wling-art
Copy link

我也遇到了这个问题

07-06 01:10:11 [ERROR] nonebot | Running Matcher(type='message', module=src.plugins.cave, lineno=40) failed.
Traceback (most recent call last):
  File "/opt/mcsmanager/daemon/data/InstanceData/aa56675d84f54b42becf6e7b2f9d1225/bot.py", line 13, in <module>
    nonebot.run()
  File "/root/.cache/pypoetry/virtualenvs/u1bot-1qZ_NDF8-py3.12/lib/python3.12/site-packages/nonebot/__init__.py", line 335, in run
    get_driver().run(*args, **kwargs)
  File "/root/.cache/pypoetry/virtualenvs/u1bot-1qZ_NDF8-py3.12/lib/python3.12/site-packages/nonebot/drivers/fastapi.py", line 186, in run
    uvicorn.run(
  File "/root/.cache/pypoetry/virtualenvs/u1bot-1qZ_NDF8-py3.12/lib/python3.12/site-packages/uvicorn/main.py", line 577, in run
    server.run()
  File "/root/.cache/pypoetry/virtualenvs/u1bot-1qZ_NDF8-py3.12/lib/python3.12/site-packages/uvicorn/server.py", line 65, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/root/.pyenv/versions/3.12.3/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
  File "/root/.pyenv/versions/3.12.3/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
  File "/root/.cache/pypoetry/virtualenvs/u1bot-1qZ_NDF8-py3.12/lib/python3.12/site-packages/nonebot/message.py", line 476, in check_and_run_matcher
    await _run_matcher(
> File "/root/.cache/pypoetry/virtualenvs/u1bot-1qZ_NDF8-py3.12/lib/python3.12/site-packages/nonebot/message.py", line 428, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "/root/.cache/pypoetry/virtualenvs/u1bot-1qZ_NDF8-py3.12/lib/python3.12/site-packages/nonebot/internal/matcher/matcher.py", line 850, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "/root/.cache/pypoetry/virtualenvs/u1bot-1qZ_NDF8-py3.12/lib/python3.12/site-packages/nonebot/internal/matcher/matcher.py", line 825, in simple_run
    await handler(
  File "/root/.cache/pypoetry/virtualenvs/u1bot-1qZ_NDF8-py3.12/lib/python3.12/site-packages/nonebot/dependencies/__init__.py", line 94, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
  File "/opt/mcsmanager/daemon/data/InstanceData/aa56675d84f54b42becf6e7b2f9d1225/src/plugins/cave/__init__.py", line 150, in _
    await cave_del.finish(
  File "/root/.cache/pypoetry/virtualenvs/u1bot-1qZ_NDF8-py3.12/lib/python3.12/site-packages/nonebot/internal/matcher/matcher.py", line 582, in finish
    await cls.send(message, **kwargs)
  File "/root/.cache/pypoetry/virtualenvs/u1bot-1qZ_NDF8-py3.12/lib/python3.12/site-packages/nonebot/internal/matcher/matcher.py", line 566, in send
    return await bot.send(event=event, message=_message, **kwargs)
  File "/root/.cache/pypoetry/virtualenvs/u1bot-1qZ_NDF8-py3.12/lib/python3.12/site-packages/nonebot/adapters/onebot/v11/bot.py", line 228, in send
    return await self.__class__.send_handler(self, event, message, **kwargs)
  File "/root/.cache/pypoetry/virtualenvs/u1bot-1qZ_NDF8-py3.12/lib/python3.12/site-packages/nonebot/adapters/onebot/v11/bot.py", line 181, in send
    return await bot.send_msg(**params)
  File "/root/.cache/pypoetry/virtualenvs/u1bot-1qZ_NDF8-py3.12/lib/python3.12/site-packages/nonebot/internal/adapter/bot.py", line 122, in call_api
    raise exception
  File "/root/.cache/pypoetry/virtualenvs/u1bot-1qZ_NDF8-py3.12/lib/python3.12/site-packages/nonebot/internal/adapter/bot.py", line 97, in call_api
    result = await self.adapter._call_api(self, api, **data)
  File "/root/.cache/pypoetry/virtualenvs/u1bot-1qZ_NDF8-py3.12/lib/python3.12/site-packages/nonebot/adapters/onebot/v11/adapter.py", line 147, in _call_api
    return handle_api_result(await self._result_store.fetch(seq, timeout))
  File "/root/.cache/pypoetry/virtualenvs/u1bot-1qZ_NDF8-py3.12/lib/python3.12/site-packages/nonebot/adapters/onebot/v11/utils.py", line 58, in handle_api_result
    raise ActionFailed(**result)
nonebot.adapters.onebot.v11.exception.ActionFailed: ActionFailed(status='failed', retcode=1200, data=None, message='Error: 文件下载失败uri CD5BAAC7AEF9328AC0F4FCA3547AC376.jpg 解析失败,TypeError [ERR_INVALID_URL]: Invalid URL 可能CD5BAAC7AEF9328AC0F4FCA3547AC376.jpg不存在\n    at handleOb11FileLikeMessage (file:///usr/src/app/napcat/napcat.mjs:25881:11)\n    at async Object.image (file:///usr/src/app/napcat/napcat.mjs:25930:57)\n    at async createSendElements (file:///usr/src/app/napcat/napcat.mjs:26048:24)\n    at async SendMsg._handle (file:///usr/src/app/napcat/napcat.mjs:26330:9)\n    at async SendMsg.websocketHandle (file:///usr/src/app/napcat/napcat.mjs:25755:23)\n    at async ReverseWebsocket.onmessage (file:///usr/src/app/napcat/napcat.mjs:30685:28)\n    at async WebSocket.<anonymous> (file:///usr/src/app/napcat/napcat.mjs:30724:7)', wording='Error: 文件下载失败uri CD5BAAC7AEF9328AC0F4FCA3547AC376.jpg 解析失败,TypeError [ERR_INVALID_URL]: Invalid URL 可能CD5BAAC7AEF9328AC0F4FCA3547AC376.jpg不存在\n    at handleOb11FileLikeMessage (file:///usr/src/app/napcat/napcat.mjs:25881:11)\n    at async Object.image (file:///usr/src/app/napcat/napcat.mjs:25930:57)\n    at async createSendElements (file:///usr/src/app/napcat/napcat.mjs:26048:24)\n    at async SendMsg._handle (file:///usr/src/app/napcat/napcat.mjs:26330:9)\n    at async SendMsg.websocketHandle (file:///usr/src/app/napcat/napcat.mjs:25755:23)\n    at async ReverseWebsocket.onmessage (file:///usr/src/app/napcat/napcat.mjs:30685:28)\n    at async WebSocket.<anonymous> (file:///usr/src/app/napcat/napcat.mjs:30724:7)', echo='35')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants