[Bug] 知识库图片访问返回 500:large object 90563 does not exist
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Start with apps/oss/serializers/file.py and trace FileSerializer.Operate.get() through File.get_bytes() to the lo_get() read path. Reproduce the missing large object using the issue's SQL steps, then decide how the endpoint should report missing file data without exposing the PostgreSQL error. Done means the response has clear semantics and the reproducer no longer returns the raw database error; an open linked pull request shows work is already underway.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Contact Information
申凯波
MaxKB Version
v2.10.7-lts
Problem Description
访问知识库文档中的图片地址返回 500:
- URL:
https://<MaxKB域名>/oss/file/<file_id> - 响应:
{"code": 500, "message": "large object 90563 does not exist", "data": null}
现象
- 接口返回 500,错误信息为
large object 90563 does not exist(PostgreSQL 原始报错直接透出) - 该报错说明
file表中对应文件记录仍然存在(若记录不存在,接口会返回 404 "File not found"),但其loid(90563)指向的大对象在数据库中已不存在,即"元数据在、二进制数据丢" - 影响:该图片无法访问,知识库分段/问答中引用该图片的位置显示异常
- 大对象缺失的具体原因尚未定位
Steps to Reproduce
在全新的 v2.10.7-lts 环境(Docker 部署)中可 100% 复现该现象:
-
上传一个含图片的文档(如 docx/pdf)到知识库,等待解析完成;或通过聊天窗口发送任意图片/文件
-
在浏览器登录后打开该文件地址
https://<MaxKB域名>/oss/file/<file_id>,此时文件正常显示 -
进入 MaxKB 的 PostgreSQL 数据库(Docker 部署时为 maxkb 库),查出该文件对应的大对象 ID:
SELECT loid FROM file WHERE id = '<file_id>'; -
删除该大对象,模拟"file 记录存在、但大对象缺失"的数据库状态:
SELECT lo_unlink('<上一步查出的 loid>'); -
再次访问
https://<MaxKB域名>/oss/file/<file_id>,返回:{"code": 500, "message": "large object <loid> does not exist", "data": null}
说明:任意来源的文件(知识库图片、聊天附件等)均走同一个 File.get_bytes() → lo_get() 读取路径,用任意文件复现同样有效。第 4 步仅用于模拟线上观察到的数据库状态,大对象缺失的真实原因尚未定位。
The expected correct result
- 文件数据应完整保留,文件地址可正常访问;或
- 当文件数据已丢失时,接口应返回语义明确的错误(如 404/410 及友好提示),不应将数据库原始报错以 500 形式透出给前端
Related log output
{"code": 500, "message": "large object 90563 does not exist", "data": null}
Additional Information
-
出问题的代码路径:
apps/oss/serializers/file.pyFileSerializer.Operate.get()→File.get_bytes()→SELECT lo_get(loid::oid, ...)(PostgreSQL 错误 42704) -
数据库中核对该文件状态的 SQL:
SELECT id, file_name, loid, sha256_hash, source_type, source_id, create_time FROM file WHERE id = '<file_id>'; SELECT oid FROM pg_largeobject_metadata WHERE oid = '<loid>'; -- 无结果即大对象已缺失
- Lingua principale
- Python
- Stelle
- 23k
- Fork
- 3.3k
- Merge medio
- 1h 43m
- PR unite (30g)
- 238
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di 1Panel-dev/MaxKB
-
[Bug] 共享资源中创建 mcp 工具,在共享工具里能显示,智能体中点击无法直接使用,建议隐藏Forse già presa @zyyfit l’ha presa 1 giorno fa. ApertaType: Bug
1Panel-dev/MaxKB#7361 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] 普通用户新建智能体引用共享工具,点击保存报没有权限Forse già presa @zyyfit l’ha presa 1 giorno fa. ApertaType: Bug
1Panel-dev/MaxKB#7360 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] 文档标签检索节点关联上百个知识库,刷新页面,获取不到标签信息Forse già presa @zyyfit l’ha presa 19 giorni fa. Aperta
1Panel-dev/MaxKB#7199 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[Feature] 知识库文档上传单文件大小上限(当前固定 1000MB)希望支持环境变量配置Forse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
1Panel-dev/MaxKB#7081 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] 对接 vLLM 部署Qwen3.8-27B模型,开启思考模式后前端无法显示思考过程Forse di nuovo libera @zyyfit l’ha presa 31 giorni fa e non c’è nessuna pull request aperta. ApertaStatus: Awaiting Feedback
1Panel-dev/MaxKB#7069 · 9 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di 1Panel-dev/MaxKB
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
infrastructure qa
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
khuisman/mcp-gee-sweet#1068 ·
I maintainer di solito rispondono entro 1 giorno
-
The book has a Nix install section that chelis.ch lacks, and it names two of the three systemsApertaarea:ecosystem documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Chelis-Lang/chelis#3866 ·
I maintainer di solito rispondono entro 1 giorno
-
`lvm_compact` has no self-hosted twin, and `docs/158` §5 says every language-face component mustApertabug sev-3 vm
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
issue: Picking a prompt from the / menu in a channel inserts a command chip instead of the promptApertabug confirmed issue
Difficoltà 2/5 Mezza giornata Idoneità per principianti 78/100
open-webui/open-webui#32712 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno