PATCH /notes/:noteId intermittently returns 500 after ~6 seconds with no body detail
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 45/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 冷清
- 技術堆疊
- typescript
研究方向
從 PATCH /v1/notes/:noteId 請求路徑開始,使用所述的時序與重試模式重現間歇性故障。追蹤請求通過 API 用戶端與後端邊界的過程,接著利用回應狀態、延遲以及儲存層行為來找出故障;確認原因並取得適當且穩定的錯誤回應或有文件記錄的修正後,即可視為完成。
由索引模型根據 Issue 內容生成。
描述
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/
- 主要語言
- TypeScript
- 星號
- 20
- 分支
- 8
- 平均合併
- 47 分鐘
- 30 天內合併 PR
- 5
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
hackmdio/api-client 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 74/100
hackmdio/api-client#73 ·
-
難度 5/5 一週以上 新手友好度 45/100
hackmdio/api-client#48 ·
-
難度 5/5 一週以上 新手友好度 20/100
hackmdio/api-client#13 · 1 則留言 · 1 個 reaction ·
-
難度 3/5 1-2 天 新手友好度 35/100
hackmdio/api-client#6 · 1 則留言 ·
-
難度 5/5 一週以上 新手友好度 25/100
hackmdio/api-client#2 · 2 則留言 · 1 個 reaction ·
查看 hackmdio/api-client 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
MetaMask/eth-phishing-detect#317371 ·
維護者通常 1 天內回覆
-
android:player ios:player
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 92/100
erkamyaman/rust-anything#963 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 72/100
ZdruzenieSTROM/webstrom-frontend#934 ·
維護者通常 1 天內回覆
-
bug(worker): detector run is marked failed and never retried when span download fails可能已有人在做 @jagrutgarg 今天認領。 未關閉bug
難度 2/5 1-3 小時 新手友好度 72/100
traceroot-ai/traceroot#3434 · 1 則留言 ·
維護者通常 1 天內回覆