Skip to content

fix: return 422 instead of 500 for non-versionable labelled version requests - #308

Merged
kptdobe merged 1 commit into
mainfrom
fix/versionsource-422-non-versionable
Aug 3, 2026
Merged

fix: return 422 instead of 500 for non-versionable labelled version requests#308
kptdobe merged 1 commit into
mainfrom
fix/versionsource-422-non-versionable

Conversation

@kptdobe

@kptdobe kptdobe commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • POST /versionsource on a binary file (jpg/png/pdf/etc) can never create a version by design (shouldCreateVersion gates to html/json only, see fix(version): heal ContentType for legacy octet-stream files on labelled version #288). The rejection returned 500, misclassifying an expected, non-retryable outcome as a server error.
  • ClickHouse showed a ~1200-request 500 spike from a bulk media migration (netcentric/almac-web) calling this endpoint on every imported asset, all correctly-but-noisily rejected. Switched the response to 422 so this stops inflating 5xx error-rate alerts, and downgraded the diagnostic log from console.error to console.warn to match.

Test plan

  • Updated test/storage/version/put.test.js regression test to assert 422 (verified it failed against the old 500 behavior first)
  • npm test — 479 passing
  • npm run lint — clean

@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@buuhuu buuhuu left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

…equests

POST /versionsource on a binary file (jpg/png/pdf/etc) can never create a
version by design (COR-46/COR-55, #288) — but the rejection returned 500,
misclassifying an expected, non-retryable outcome as a server error. A bulk
media migration hammering this endpoint on ~1200 assets showed up as a 500
spike in ClickHouse, when nothing was actually broken.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@kptdobe
kptdobe force-pushed the fix/versionsource-422-non-versionable branch from 46c384f to 1f5f582 Compare August 3, 2026 12:42
@kptdobe
kptdobe merged commit dc03b91 into main Aug 3, 2026
6 checks passed
@kptdobe
kptdobe deleted the fix/versionsource-422-non-versionable branch August 3, 2026 12:44
adobe-bot pushed a commit that referenced this pull request Aug 3, 2026
## [1.13.4](v1.13.3...v1.13.4) (2026-08-03)

### Bug Fixes

* return 422 instead of 500 for non-versionable labelled version requests ([#308](#308)) ([dc03b91](dc03b91)), closes [#288](#288)
@adobe-bot

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 1.13.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants