[Bug] 知识库图片访问返回 500:large object 90563 does not exist
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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>'; -- 无结果即大对象已缺失
- Lenguaje dominante
- Python
- Estrellas
- 23k
- Forks
- 3.3k
- Merge medio
- 1 h 43 min
- PR fusionados (30 d)
- 238
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de 1Panel-dev/MaxKB
-
[Bug] 共享资源中创建 mcp 工具,在共享工具里能显示,智能体中点击无法直接使用,建议隐藏Posiblemente ocupada @zyyfit la tomó hace 1 día. AbiertoType: Bug
1Panel-dev/MaxKB#7361 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
[Bug] 普通用户新建智能体引用共享工具,点击保存报没有权限Posiblemente ocupada @zyyfit la tomó hace 1 día. AbiertoType: Bug
1Panel-dev/MaxKB#7360 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
[Bug] 文档标签检索节点关联上百个知识库,刷新页面,获取不到标签信息Posiblemente ocupada @zyyfit la tomó hace 20 días. Abierto
1Panel-dev/MaxKB#7199 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
[Feature] 知识库文档上传单文件大小上限(当前固定 1000MB)希望支持环境变量配置Quizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
1Panel-dev/MaxKB#7081 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Bug] 对接 vLLM 部署Qwen3.8-27B模型,开启思考模式后前端无法显示思考过程Quizá libre de nuevo @zyyfit la tomó hace 31 días y no hay ningún pull request abierto. AbiertoStatus: Awaiting Feedback
1Panel-dev/MaxKB#7069 · 9 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de 1Panel-dev/MaxKB
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
infrastructure qa
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
khuisman/mcp-gee-sweet#1068 ·
Los mantenedores suelen responder en 1 día
-
The book has a Nix install section that chelis.ch lacks, and it names two of the three systemsAbiertoarea:ecosystem documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Chelis-Lang/chelis#3866 ·
Los mantenedores suelen responder en 1 día
-
`lvm_compact` has no self-hosted twin, and `docs/158` §5 says every language-face component mustAbiertobug sev-3 vm
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
issue: Picking a prompt from the / menu in a channel inserts a command chip instead of the promptAbiertobug confirmed issue
Dificultad 2/5 Medio día Aptitud para principiantes 78/100
open-webui/open-webui#32712 · 2 comentarios ·
Los mantenedores suelen responder en 1 día