[Bug] 知识库图片访问返回 500:large object 90563 does not exist
Mantenedores costumam responder em até 1 dia
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 35/100
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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>'; -- 无结果即大对象已缺失
- Linguagem predominante
- Python
- Estrelas
- 23k
- Forks
- 3.3k
- Merge médio
- 1h 43min
- PRs com merge (30d)
- 238
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de 1Panel-dev/MaxKB
-
[Bug] 共享资源中创建 mcp 工具,在共享工具里能显示,智能体中点击无法直接使用,建议隐藏Talvez já em andamento @zyyfit assumiu há 2 dias. AbertaType: Bug
1Panel-dev/MaxKB#7361 · 1 comentário · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
[Bug] 普通用户新建智能体引用共享工具,点击保存报没有权限Talvez já em andamento @zyyfit assumiu há 2 dias. AbertaType: Bug
1Panel-dev/MaxKB#7360 · 1 comentário · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
[Bug] 文档标签检索节点关联上百个知识库,刷新页面,获取不到标签信息Talvez já em andamento @zyyfit assumiu há 20 dias. Aberta
1Panel-dev/MaxKB#7199 · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
[Feature] 知识库文档上传单文件大小上限(当前固定 1000MB)希望支持环境变量配置Talvez livre de novo Um pull request para esta issue foi fechado sem ser mesclado. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 72/100
1Panel-dev/MaxKB#7081 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
[Bug] 对接 vLLM 部署Qwen3.8-27B模型,开启思考模式后前端无法显示思考过程Talvez livre de novo @zyyfit assumiu há 32 dias e não há nenhum pull request aberto. AbertaStatus: Awaiting Feedback
1Panel-dev/MaxKB#7069 · 9 comentários · 1 responsável ·
Mantenedores costumam responder em até 1 dia
Todas as issues de 1Panel-dev/MaxKB
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
-
[Bug] to_ical lexicographical/default sorting moves URL property between two X-WR- propertiesAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
collective/icalendar#1968 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Deferred from #1869: Complete the companion pytest guardrail update noted in the PR description...Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 95/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
NousResearch/hermes-agent#140958 ·
Mantenedores costumam responder em até 1 dia
-
Bug triage/confirmed
Dificuldade 2/5 Meio dia Facilidade para iniciantes 85/100
agentscope-ai/agentscope#3355 ·
Mantenedores costumam responder em até 2 dias