PATCH /us/report returns 500 when the app saves a finished report's output (report 4501)
Les mainteneurs répondent en général sous 3 jours
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 22/100
Piste de recherche
Start in policyengine_api/routes/report_output_routes.py at the PATCH /<country_id>/report handler, and follow the call to update_report_output, which may reject completion while active_run_id is set. The exception is in the final except Exception branch, so the root cause needs the production log entry for report 4501 near 18:16 UTC; without log access, start from the run-lifecycle logic. Done means that handler no longer returns 500 for this case and returns a 4xx with a clear code when the update is rejected on purpose.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
What happened
On 2026-10-16 around 18:16 UTC, the app finished the society-wide calculation for report 4501 (reform policy 98753 over 2, US, 2026; requested_at 18:12:38 UTC, active_run_id e30158cb-0aad-4dd1-bde0-e80a50485ed9). The economy endpoint returned the result, and the page showed it. The app then saved the result to the report record with PATCH /us/report, and the API answered 500 twice (the app retries once):
[ResultPersister] Persistence failed, retrying once... Error: Failed to update report 4501: 500
at updateReport (app/src/api/report.ts)
at ResultPersister.persistToReport (app/src/libs/calculations/ResultPersister.ts)
The request body is the app's standard completed-report payload (ReportAdapter.toCompletedReportPayload):
{ "id": 4501, "status": "complete", "output": { ...economy output... } }
Effect
GET /us/report/4501 still returns status: pending, finished_at: null, no output. Clients show the report as in progress, and every visit asks the economy endpoint again (cached, so fast, but the record never completes).
Where to look
policyengine_api/routes/report_output_routes.py (PATCH /<country_id>/report): the 500 is the final except Exception branch, which logs "Unexpected error updating report #4501 for country us" with the stack trace. A guess, not verified: the record has an active_run_id (run-based report lifecycle) and update_report_output may not handle a client-side completion for a report whose run is still marked active. The same day had the SPM_CONFIGURATION_UNAVAILABLE outage (#3945), which may have left runs in an inconsistent state.
Requests
- Find the exception in the logs for report 4501 at about 18:16 UTC and fix it.
- If the update is rejected on purpose (for example, a run owns the record), return a 4xx with a clear code, not a 500, so clients can stop retrying and show the right state.
🤖 Generated with Claude Code
- Langage dominant
- Python
- Étoiles
- 18
- Forks
- 33
- Merge moyen
- 2 j 6 h
- PR mergées (30 j)
- 32
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de PolicyEngine/policyengine-api
-
Difficulté 1/5 1-3 heures Accessibilité débutants 88/100
PolicyEngine/policyengine-api#3911 ·
Les mainteneurs répondent en général sous 3 jours
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 82/100
PolicyEngine/policyengine-api#3910 ·
Les mainteneurs répondent en général sous 3 jours
-
Report each day's production telemetry error groups as GitHub issuesPeut-être pris @anth-volk l’a pris aujourd’hui. Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 20/100
PolicyEngine/policyengine-api#3989 ·
Les mainteneurs répondent en général sous 3 jours
-
Include each variable's quantity type (stock or flow) in the country metadataPeut-être pris @anth-volk l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 30/100
PolicyEngine/policyengine-api#3986 ·
Les mainteneurs répondent en général sous 3 jours
-
Enforce SQLAlchemy-only database connections and Alembic-only schema changesPeut-être pris @anth-volk l’a pris il y a 1 jour. Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
PolicyEngine/policyengine-api#3978 ·
Les mainteneurs répondent en général sous 3 jours
Toutes les issues de PolicyEngine/policyengine-api
Issues similaires
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
ansys/pyansys-common-mcp#213 ·
Les mainteneurs répondent en général sous 3 jours
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 67/100
freedomofpress/dangerzone#1594 ·
Les mainteneurs répondent en général sous 3 jours
-
priority:P1 status:in-review type:bug
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
randomparity/kdive#3317 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
area:ci
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
mesonbuild/meson#16281 ·
Les mainteneurs répondent en général sous 1 jour