PATCH /notes/:noteId intermittently returns 500 after ~6 seconds with no body detail
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 45/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Calme
- Stack technique
- typescript
Piste de recherche
Commencez par le chemin de requête PATCH /v1/notes/:noteId et reproduisez l’échec intermittent en utilisant le schéma de temporisation et de nouvelle tentative décrit. Suivez la requête à travers le client API et la frontière du backend, puis utilisez le statut de la réponse, le délai et le comportement de la couche de stockage pour identifier l’échec ; le travail est terminé lorsque la cause est confirmée et qu’une réponse d’erreur stable et appropriée ou un correctif documenté est disponible.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Summary
Calls to PATCH /v1/notes/:noteId intermittently return HTTP 500 with the body {"error":"Failed to update note"}. The failure is not deterministic — the exact same request succeeds when retried 1–2 seconds later. The issue resolves itself within a minute.
Endpoint
PATCH https://api.hackmd.io/v1/notes/<note-id>
Request details
| Field | Value |
|---|---|
| Method | PATCH |
| Content-Type | application/json |
| Authorization | Bearer <token> (valid, same token works immediately after) |
| Body | { "content": "<markdown string ~400 bytes>" } |
| Protocol | HTTP/3 |
| TLS | TLSv1.3 |
Observed response
HTTP/1.1 500 Internal Server Error
Content-Type: application/json
{"error":"Failed to update note"}
Timing evidence
From Cloudflare Worker logs (the request is routed through a Cloudflare Worker CORS proxy before reaching the HackMD API):
| Metric | Value |
|---|---|
| Worker CPU time | ~0 ms (proxy only, no compute) |
| Wall time (total round-trip) | ~6,072 ms |
| Worker outcome | ok (worker completed normally) |
| Response status received from HackMD | 500 |
The 6-second wall time indicates the HackMD backend held the connection open before returning the 500 — this is not a timeout on the client side.
Reproduction pattern
- Frequency: Occasional, roughly 1 in 20–30 PATCH calls during normal use
- Recovery: Retrying the identical request 1.5–2 seconds later succeeds
- The note content is valid markdown (plain text, checkboxes, headings)
- The note is owned by the authenticated user — no permission issues
What is NOT the cause
- ❌ Invalid token — the same token succeeds immediately on retry
- ❌ Permission / ownership — same note, same token works after retry
- ❌ Malformed body — same payload succeeds on retry
- ❌ Client-side timeout — the server held the connection for 6 seconds before responding 500
- ❌ CORS proxy issue — the proxy passes the request and response through transparently; its own outcome is
ok - ❌ Rate limiting — there is no burst of requests, this happens on isolated single saves
Impact
Users see a "Save failed" error and must manually retry. With a client-side retry in place the error is hidden, but the underlying instability means saves are silently slower and occasionally double-charged against any rate limits.
Request
- Investigate whether the backend experiences transient write failures on the note storage layer
- If a 500 is unavoidable, consider returning a
503 Service Unavailablewith aRetry-Afterheader so clients can back off intelligently - A more descriptive error body (e.g. the underlying cause) would help distinguish storage errors from permission or validation errors
Environment
- API version: v1
- Client: browser (Chrome 145, macOS)
- Region inferred from Cloudflare colo:
MRS(Marseille edge, request origin: Egypt)
Test
- You can test it on this repo https://github.com/Arigatouz/ali-productive-board where i use HackMD like. DB
- Here is a live version of it https://arigatouz.github.io/ali-productive-board/
- Langage dominant
- TypeScript
- Étoiles
- 20
- Forks
- 8
- Merge moyen
- 47 min
- PR mergées (30 j)
- 5
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
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 hackmdio/api-client
-
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
hackmdio/api-client#73 ·
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 45/100
hackmdio/api-client#48 ·
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 20/100
hackmdio/api-client#13 · 1 commentaire · 1 réaction ·
-
Parse noteId methodOuverte
Difficulté 3/5 1-2 jours Accessibilité débutants 35/100
hackmdio/api-client#6 · 1 commentaire ·
-
document creation optionsOuverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
hackmdio/api-client#2 · 2 commentaires · 1 réaction ·
Toutes les issues de hackmdio/api-client
Issues similaires
-
area:config bug priority:medium
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
Doezer/Questarr#1451 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
sidebandstudio/clawtrate#1156 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
WenyuChiou/agent-board#1993 ·
Les mainteneurs répondent en général sous 1 jour
-
bug design
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
Colorado-Startups/coloradostartups.org#151 ·
Les mainteneurs répondent en général sous 1 jour
-
question
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
jarrodwatts/claude-hud#883 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour