Discussion API: missing thread returns 500 (ForumV2RequestError not mapped to ThreadNotFoundError)
Los mantenedores suelen responder en 1 día
@mbhavu2007-lang ya está trabajando en esto.
Desde el 31/10/2026.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 72/100
Línea de trabajo
Empieza en lms/djangoapps/discussion/rest_api/api.py en _get_thread_and_context y _get_comment_and_context, que capturan CommentClientRequestError cuando falta un hilo o un comentario. La llamada que falla es Thread._retrieve en comment_client/thread.py, que llama a forum.api.get_thread y deja escapar forum.utils.ForumV2RequestError. Puedes traducir ese error a CommentClientRequestError en el cliente de comentarios o capturarlo en las cláusulas except de esas funciones. Está terminado cuando un DELETE, GET o PATCH sobre un hilo inexistente devuelve 404 en lugar de 500, con una prueba que lo cubra.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
With the forum v2 backend (openedx/forum, used in-process), DELETE /api/discussion/v1/threads/<id>/ for a thread that no longer exists returns a bare 500, not 404:
forum.utils.ForumV2RequestError: Thread does not exist with Id: 137
File ".../forum/api/threads.py", line 141, in get_thread
File ".../forum/backends/mysql/api.py", line 993, in validate_object
raise self.model.DoesNotExist(
Internal Server Error: /api/discussion/v1/threads/137/
Cause: _get_thread_and_context in lms/djangoapps/discussion/rest_api/api.py turns a missing thread into ThreadNotFoundError (404) by catching CommentClientRequestError, the error the old HTTP comments-service client raised. The comment client now calls forum.api.get_thread directly (comment_client/thread.py, Thread._retrieve), which raises forum.utils.ForumV2RequestError instead. Nothing maps it, so it escapes as a 500. Any endpoint that goes through _get_thread_and_context should behave the same way (GET/PATCH/DELETE of a thread, and a thread's comment list). The same except CommentClientRequestError pattern is used elsewhere in the module, e.g. _get_comment_and_context.
Impact: a client cannot tell "already deleted" from a server fault. An idempotent cleanup, such as a retry or a teardown after the UI deleted the post, fails with a 500 and an error in the logs.
Expected: 404, as before. Either the comment client translates ForumV2RequestError into CommentClientRequestError, or these except clauses also catch it.
Environment: Tutor main with tutor-forum, openedx-forum 0.4.7 (MySQL backend), 2026-09-23. Code unchanged on master as of 2026-10-13. Found by the Open edX end-to-end test suite.
- Lenguaje dominante
- Python
- Estrellas
- 8.2k
- Forks
- 4.4k
- Merge medio
- 2 d 10 h
- PR fusionados (30 d)
- 40
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 openedx/openedx-platform
-
v3 notification preferences: PUT with email_cadence but no notification_channel raises KeyError (500)Quizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
openedx/openedx-platform#39221 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
openedx/openedx-platform#39169 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
openedx/openedx-platform#39084 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 Menos de una hora Aptitud para principiantes 82/100
openedx/openedx-platform#38792 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
openedx/openedx-platform#38544 ·
Los mantenedores suelen responder en 1 día
Todos los issues de openedx/openedx-platform
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
btclib-org/btclib-wallet#1045 ·
Los mantenedores suelen responder en 1 día
-
area-templates triage:bot-seen triage:needs-human
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
microsoft/aspire#22356 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
[Train] An elastic ScalingConfig(num_workers=(0, 0)) is accepted and the run waits foreverPosiblemente ocupada @wguo7 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
ray-project/ray#68217 ·
Los mantenedores suelen responder en 2 días