The error that succeeded: HTTP 500 that created the article
Описание и применение
Автоматизированный скрипт публикации заметок в dev.to получил ошибку HTTP 500, но статья была создана. При повторных попытках возникали дубли. Решение – проверять наличие статьи после 5xx‑ответа, чтобы избежать повторных POST‑запросов.
Задача
Automated article publishing scripts misinterpret HTTP 500 responses as failures, leading to duplicate posts when the server actually succeeded in creating the article.
Результат
By checking for existing articles after a 5xx response, the automation avoided duplicate posts and handled server inconsistencies.
Рабочий процесс
- POST /api/articles to publish note
- Receive HTTP 500 and treat as failure
- Retry POST with backoff
- Receive HTTP 422 on duplicate canonical
- Verify article existence via GET /api/articles/me
- Confirm article ID and canonical
- Skip further retries
Доказательства
The article existed.
HTTP 500 — twice across attempts — script treated it as failure
HTTP 422 — "Canonical url has already been taken"
- Дата записи: 2026-09-07T01:21:38.461Z