PATCH /notes/:noteId intermittently returns 500 after ~6 seconds with no body detail
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- typescript
Hướng nghiên cứu
Bắt đầu với đường dẫn yêu cầu PATCH /v1/notes/:noteId và tái hiện lỗi không liên tục bằng cách sử dụng mẫu timing và retry được mô tả. Theo dõi yêu cầu qua API client và ranh giới backend, sau đó sử dụng status của response, độ trễ và hành vi của storage layer để xác định lỗi; được xem là hoàn tất khi đã xác nhận nguyên nhân và có response lỗi ổn định, phù hợp hoặc một bản sửa lỗi được ghi lại.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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/
- Ngôn ngữ chính
- TypeScript
- Star
- 20
- Fork
- 8
- Merge trung bình
- 47 phút
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của hackmdio/api-client
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
hackmdio/api-client#73 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
hackmdio/api-client#48 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
hackmdio/api-client#13 · 1 bình luận · 1 reaction ·
-
Parse noteId methodĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
hackmdio/api-client#6 · 1 bình luận ·
-
document creation optionsĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
hackmdio/api-client#2 · 2 bình luận · 1 reaction ·
Tất cả issue của hackmdio/api-client
Issue tương tự
-
Release utils decode git output chunk by chunk, so a multi-byte character can turn into U+FFFDCó thể đã có người làm @goranai đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
vercel-labs/ui#1494 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Task retarget keeps the old host in task scope and adds the new host in a form that matches nothingCó thể đã có người làm @chaitanya0305 đã nhận hôm nay. Đang mởbug P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
BaaRai/ARTEX#652 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
compiler-explorer/compiler-explorer#9710 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày