#10068·AstrBot

[Bug] 插件使用github源时更新因github api返回错误而导致的更新/安装失败

Author: iona-sCreated Sep 13, 2026Updated Sep 14, 2026
Labelsbug

问题描述

我个人是习惯在插件开发和发版前先在自己生产环境bot上先跑跑,于是会用到使用github源安装/更新插件

当前插件在使用github源时的更新逻辑是先使用api获取远程仓库的默认branch名称 而如果因为种种原因连不上github api时,如网络原因,或是触发rate limit 403,便会默认回退为main作为名称 于是如果远程实际是master在进行仓库下载时便会404,导致更新报错

我个人觉得这样可能不太合适,虽然可以通过在metadata.yamlrepo显示注明分支而绕过解析,但包括官方插件模板在内不少插件应该都是使用的master作为默认分支,在更新时不说默认使用master,至少可以两个都试试吧

如何复现?

问题描述内应该够清晰了

AstrBot 版本

4.28.0

操作系统

Linux

部署方式

docker

使用的消息平台适配器

ob11

错误日志

[2026-09-13 23:40:26.601] [Core]
[INFO]
[services.plugin_service:1783]: Updating plugin astrbot_plugin_imgexploration
[2026-09-13 23:40:26.602] [Core]
[INFO]
[star.updater:262]: Updating plugin at path: /AstrBot/data/plugins/astrbot_plugin_imgexploration, repository URL: https://github.com/iona-s/astrbot_plugin_imgexploration
[2026-09-13 23:40:27.392] [Core] [DBUG] [core.zip_updater:98]: Failed to get the default github branch for iona-s/astrbot_plugin_imgexploration: Client error '403 rate limit exceeded' for url 'https://api.github.com/repos/iona-s/astrbot_plugin_imgexploration'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403
[2026-09-13 23:40:27.393] [Core]
[INFO]
[core.zip_updater:132]: Could not get the default github branch for iona-s/astrbot_plugin_imgexploration; trying main.
[2026-09-13 23:40:27.393] [Core]
[INFO]
[core.zip_updater:292]: Downloading update for astrbot_plugin_imgexploration ...
[2026-09-13 23:40:27.394] [Core]
[INFO]
[core.zip_updater:293]: Downloading iona-s/astrbot_plugin_imgexploration from github branch main
[2026-09-13 23:40:29.607] [Core]
[ERRO]
[v4.28.0] [core.zip_updater:205]: Failed to download file: https://github.com/iona-s/astrbot_plugin_imgexploration/archive/refs/heads/main.zip -> /AstrBot/data/plugins/astrbot_plugin_imgexploration.zip: Client error '404 Not Found' for url 'https://codeload.github.com/iona-s/astrbot_plugin_imgexploration/zip/refs/heads/main'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404

辅助信息

No response

检查清单

  • 我已在 Issue 列表中搜索过相关问题仍无法解决,或该问题从未被报告过。
  • 我已尝试过禁用所有插件,排除了可能是因插件导致的问题。
  • 我报告的问题与 AstrBot 本体相关,而非在报告某一插件的问题。
  • 我已阅读并同意本项目的贡献者行为准则
  • (可选)我愿意提交 PR 以帮助修复该问题。