🐛 Improved upload error messages in the editor#28723
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughThe 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run ghost:test:ci:legacy |
✅ Succeeded | 1m 50s | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-06-23 07:00:26 UTC
ref https://linear.app/ghost/issue/ONC-1847/cant-upload-files - when an upload in the editor failed, the error shown to the user was unhelpful and could appear multiple times; this improves the message and removes the duplication, but does not by itself fix the file card showing no error at all (see note below) - the API wraps some errors with a generic `message` and puts the specific, user-facing text in `context`; the hook surfaced `message`, so the useful text was never shown. Now prefers `context`, falling back to `message` (matching the existing `getErrorMessage` convention) - the hook appended each failure to the existing errors array, so retrying a failing upload accumulated duplicate messages. Now clears errors at the start of each attempt and replaces rather than appends on failure - the underlying ONC-1847 symptom (file card showing no error when an upload fails) is fixed in @tryghost/koenig-lexical (TryGhost/Koenig#1994), which owns the file card's error rendering; this change is a prerequisite so that once that lands the file card shows the correct, non-duplicated message
32d4352 to
05cb7ff
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #28723 +/- ##
==========================================
+ Coverage 73.81% 73.87% +0.05%
==========================================
Files 1550 1557 +7
Lines 133527 134542 +1015
Branches 16065 16192 +127
==========================================
+ Hits 98561 99389 +828
- Misses 33989 34174 +185
- Partials 977 979 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|

ref https://linear.app/ghost/issue/ONC-1847/cant-upload-files
Context
This contributes to ONC-1847 (file uploads in the editor failing with no useful feedback). It does not close the issue on its own — see "Scope" below.
Problem
When an upload in the editor failed (e.g. a file exceeding the plan's upload-size limit), the error surfaced to the user was unhelpful:
Fix
apps/admin-x-framework/src/hooks/use-koenig-file-upload.ts:Wrong message shown. The API (
@tryghost/mw-error-handler) wraps some errors with a genericmessageand puts the specific, user-facing text incontext. The hook surfacedmessage. It now preferscontext, falling back tomessage— matching the existinggetErrorMessageconvention used elsewhere in the admin.Duplicate errors. The hook appended each failure to the existing
errorsarray, so retrying a failing upload accumulated duplicates. It now clears errors at the start of each attempt and replaces rather than appends on failure.Tests
Added unit tests covering both behaviours (prefer
context; no accumulation across retries). All 15 hook tests pass.Scope
The actual ONC-1847 symptom — the file card showing no error at all when an upload fails — is caused by the file card's error rendering in
@tryghost/koenig-lexicaland is fixed there in TryGhost/Koenig#1994.This PR is a prerequisite: it fixes the error text (visible today on the image card) and the duplicate-message behaviour. Once Koenig#1994 is published and bumped in Ghost, the file card will show the correct, non-duplicated message and ONC-1847 is fully resolved.
Before
CleanShot.2026-06-18.at.17.14.26.mp4
After
CleanShot.2026-06-18.at.17.24.26.mp4