You upload a featured image in Decap CMS, save your article, and suddenly the preview shows a broken image.
Or worse, the editor displays an error:
Failed to persist entry: [object Object]
You check the browser console and discover several 404 Not Found responses. Perhaps a GitHub API request also returns 401 Unauthorized.
Does this mean your CMS authentication is broken? Is the upload corrupted? Should you change your configuration?
Not necessarily.
When Decap CMS uses GitHub’s Editorial Workflow, unpublished content and production content can exist on different Git branches. Understanding that distinction is essential before troubleshooting missing images.
In this guide, I’ll explain the architecture, walk through a real troubleshooting experience from DuongHoangNam.com, and provide a repeatable process for investigating image and publishing problems without risking unpublished content.
1. Understand How Decap CMS Editorial Workflow Works
Decap CMS supports two main publishing approaches:
- Simple publishing: Changes are committed directly to the configured publication branch.
- Editorial Workflow: Unpublished content is managed through Git branches and a review process before it reaches production.
With the GitHub backend, Editorial Workflow can create a branch and pull request for a draft. Editing that draft updates the unpublished branch, while publishing merges the changes into the publication branch.
This distinction matters because a saved draft is not necessarily a publicly deployed article.
For an Astro website using GitHub and Cloudflare Pages, the overall workflow looks like this:
Decap CMS Editor
|
v
Save Draft
|
v
GitHub CMS Draft Branch
|
v
Pull Request / Review
|
v
Publish / Merge
|
v
Production Branch (main)
|
v
Cloudflare Pages Build
|
v
Published Website
The exact deployment behavior depends on your Cloudflare Pages and repository configuration.
Key takeaway: A successfully saved draft and a successfully deployed production page are different states.
Source: Decap CMS — Editorial Workflows

Illustration: In Editorial Workflow, an image saved only to a draft branch may not yet be accessible from the production website.
2. Why Images Can Return 404 While an Article Is Still a Draft
Consider this CMS configuration:
backend:
name: github
repo: your-account/your-repository
branch: main
publish_mode: editorial_workflow
media_folder: public/images/uploads
public_folder: /images/uploads
For this example, assume the website is built with Astro.
If you upload my-featured-image.webp, the intended repository location is:
public/images/uploads/my-featured-image.webp
The published website would reference it using:
/images/uploads/my-featured-image.webp
However, suppose the image has been committed only to the unpublished CMS branch.
If your browser requests:
https://example.com/images/uploads/my-featured-image.webp
the production deployment may not contain that image yet.
A 404 can therefore occur even though the upload exists in the draft branch.
That does not mean every preview image 404 is normal. The same response can also indicate:
- An incorrect media URL.
- A mismatch between filename and Markdown frontmatter.
- A missing file in the expected Git branch.
- An unsuccessful upload.
- A deployment that has not included the required commit.
- A routing or configuration problem.
The next step is to determine where the file actually exists.
Reference: Decap CMS — Configuration Options
3. A Real Troubleshooting Case from DuongHoangNam.com
While preparing a technical article for DuongHoangNam.com, I encountered an image-related issue in Decap CMS.
The environment included:
- Astro 7.4
- TypeScript
- Decap CMS with Editorial Workflow
- GitHub backend
- Cloudflare Pages
- Uploaded images stored under
public/images/uploads/ - A Sharp-based responsive WebP build pipeline
The draft contained a long technical article and a featured image.
During editing, the CMS displayed:
Failed to persist entry: [object Object]
The editor also indicated unsaved changes.
In the browser’s developer tools, I observed failed image requests. Some requests for uploaded image assets returned 404.
A GitHub API pull-request-related request also returned 401 during part of the investigation.
At that moment, several possible explanations existed, but there was not enough evidence to identify a single root cause.
What happened next?
I tried a safer, more isolated process.
First, I saved the article without its featured image.
The CMS successfully saved the draft.
Next, I added the featured image separately and saved the article again.
That operation also succeeded.
Later, after reopening or reloading the editor, the featured image displayed correctly.
What this result proves
The observations show that the CMS was capable of saving the article and subsequently saving its featured image.
They do not prove that the earlier 401 was harmless in every request, nor do they prove that browser caching caused the image delay.
The important lesson is to avoid making configuration changes based only on a generic error message.
A temporary image failure does not automatically justify replacing your OAuth configuration or disabling Editorial Workflow.
4. Diagnose the Problem in the Right Order
Use the following sequence to narrow the problem before changing code.
Step 1: Protect your unsaved content
Before refreshing the editor, copy the article body into a local Markdown file or text editor.
This is particularly important when the CMS displays UNSAVED CHANGES.
Make sure the backup includes important code examples, external links, image references, and other content that would be difficult to recreate.
Do not assume the latest changes have reached GitHub until you can verify them.
Step 2: Confirm the draft status
Open the Editorial Workflow interface.
Check whether the entry is:
- Draft
- In Review
- Ready to Publish
- Already published
Next, examine the corresponding GitHub pull request where available.
Check its state and the target branch.
If the article is still a draft, don’t use the production URL as proof that the draft image upload failed.
Step 3: Inspect the pull request’s changed files
Open the relevant GitHub pull request and select Files changed.
Look for the article and image:
src/content/blog/example-article.md
public/images/uploads/example-featured.webp
If both files appear in the pull request, you have evidence that the draft contains the Markdown entry and uploaded media.
If the image is missing, the save or upload process may not have persisted the expected asset.
If the Markdown references an image that does not appear in the branch, you have identified a mismatch that needs investigation.
Step 4: Compare the image URL and actual filename
Check the Markdown frontmatter.
For example:
---
title: "Example Technical Article"
image: "/images/uploads/example-featured.webp"
---
Compare the filename with the one committed to GitHub.
Watch for differences involving:
- Uppercase versus lowercase letters.
.png,.jpg, and.webpextensions.- Spaces or filename normalization.
- Duplicate uploads with modified names.
- Relative versus root-relative URLs.
Do not rename or delete files until you know which references are in use.
Step 5: Inspect the exact failing request
Open browser developer tools.
Navigate to:
Network → All
Enable Preserve log.
Then reproduce the error by saving the draft.
Inspect the failed request’s:
- Request URL
- HTTP status
- Request method
- Response body
- Timing
- Initiator
A 404 for a production image URL is a different problem from a failed request to the GitHub API.
Likewise, a failed upload request is different from a broken image preview.
Investigate each request independently.
Never share authentication tokens, cookies, or authorization headers in public screenshots or support conversations.
Step 6: Test the Markdown save separately
If the editor repeatedly fails while an image is attached, and your existing content is safely backed up, try isolating the image from the operation.
One possible diagnostic sequence is:
- Save the article body without the problematic featured image.
- Verify that the editor reports a successful save.
- Confirm that the draft exists in GitHub.
- Add the featured image.
- Save again.
- Inspect the resulting GitHub changes.
This approach worked during my troubleshooting session, but it should not be treated as a guaranteed fix for every Decap CMS installation.
The purpose is to isolate the failing operation.
5. What Does a GitHub API 401 Actually Mean?
HTTP 401 Unauthorized indicates an authentication-related failure for a particular request.
However, diagnosing the overall CMS from a single status code is risky.
You need to establish:
- Which endpoint returned the error?
- Was the request related to reading pull requests, saving content, or another action?
- Did a separate API request succeed?
- Is the current authenticated session valid for the intended resource?
- Did GitHub actually receive the latest draft commit?
GitHub documents how authentication, permissions, and endpoint requirements affect REST API responses.
A failed pull-request query is useful evidence, but it does not automatically establish that every CMS operation is unable to authenticate.
For example, if the editor reports CHANGES SAVED and GitHub contains the corresponding new commit, the save operation has demonstrably succeeded.
That is much stronger evidence than the presence or absence of one unrelated console error.
Reference: GitHub REST API Troubleshooting
6. Verify Your Decap CMS Media Configuration
For an Astro site using the root-level public directory, this configuration is a useful starting point:
media_folder: public/images/uploads
public_folder: /images/uploads
The two settings serve different purposes.
| Setting | Purpose |
|---|---|
media_folder |
Repository location where CMS uploads are stored |
public_folder |
URL prefix used when content references uploaded media |
For example:
Repository:
public/images/uploads/cover.webp
Published URL:
/images/uploads/cover.webp
In Astro, files under public/ are typically copied to the corresponding root-level paths in the build output.
Be careful when using collection-specific media folders, which can change how image paths are generated.
Do not replace your existing CMS configuration simply because one image failed to load.
First, compare it with the location of your committed files and the URLs generated by the CMS.
Reference: Decap CMS — Folder Collections
7. Understand the Difference Between CMS Preview, Deploy Preview, and Production
These are three separate ways of viewing content.
CMS editor preview
The editor attempts to represent your current article while you work.
It is useful for checking content and formatting, but it is not equivalent to a successful production deployment.
Deploy preview
A deploy preview can build content from an unpublished branch or pull request, provided your deployment platform is configured to support it.
This is a more realistic way to evaluate unpublished content against the site’s build system.
Production website
The production website generally reflects the deployed production branch.
If your draft has not been merged, the production site may not contain its images or Markdown file.
For image-related troubleshooting, a working deploy preview can help distinguish draft-branch content from published content.
See: Decap CMS — Deploy Preview Links
8. Safely Verify the Project Before Publishing
For an Astro project managed from Windows PowerShell, begin by inspecting the repository rather than immediately switching branches.
cd D:\Web_DHN\duonghoangnam
git fetch origin
git branch --show-current
git status -sb
git log -1 --oneline origin/main
Check the relevant GitHub pull request before making changes.
If the working directory contains uncommitted work, investigate and preserve it.
Do not use git reset --hard as a routine way to synchronize a CMS-managed repository.
When validating changes, run the existing production build:
npm.cmd run build
For a project using a post-build Sharp image optimizer, a successful build should also verify that the optimization stage completes.
Then run:
npm.cmd run preview
Before approving the article, verify:
- The featured image exists and loads.
- Inline images resolve to the correct paths.
- Markdown headings and code blocks render correctly.
- The page works on mobile and desktop.
- Light and Dark Mode remain readable.
- The generated page metadata is correct.
- No existing production content has been unintentionally changed.
If code changes were made, also run:
git diff --check
This helps detect whitespace errors, although it is not a substitute for build and visual testing.
9. Avoid These Common Troubleshooting Mistakes
Mistake 1: Reuploading the same image repeatedly
This can create confusing duplicates and additional filenames.
Check whether the existing upload is already present in the draft branch before trying again.
Mistake 2: Treating every 404 as a failed upload
An image may exist in an unpublished branch while remaining unavailable at the production URL.
Verify the Git branch and deployment before drawing conclusions.
Mistake 3: Changing OAuth configuration immediately
An isolated 401 should trigger request-level investigation, not a full authentication rewrite.
Changing credentials without adequate evidence can introduce new problems and security risks.
Mistake 4: Disabling Editorial Workflow
Switching to simple publishing changes how content reaches the production branch.
It should be a deliberate workflow decision, not an emergency workaround for a broken thumbnail.
Mistake 5: Publishing before reviewing the diff
A saved draft may contain unintended changes, incorrect image references, or incomplete article content.
Review the proposed changes before merging.
10. A Practical Troubleshooting Checklist
Use this checklist whenever uploaded images fail to appear.

Illustration: A practical troubleshooting sequence. The interface and network results shown are examples, not screenshots or logs from an actual incident.
- Back up the current Markdown content.
- Confirm whether the entry is Draft or Published.
- Find the relevant GitHub branch or pull request.
- Verify the image exists in that branch.
- Compare the Markdown image URL with the actual filename.
- Inspect the exact failing request in Network tools.
- Separate API authentication errors from image-loading errors.
- Test the save operation with and without the image when appropriate.
- Check the deploy preview if available.
- Run the project’s production build.
- Verify images and layouts before publishing.
This process helps turn a vague CMS error into a smaller, verifiable problem.
11. Frequently Asked Questions
Why does Decap CMS show a broken image after saving a draft?
One possible explanation is that the image exists in an unpublished Git branch but not in the production deployment. Incorrect paths, missing files, failed uploads, and preview issues can also cause broken images.
Does CHANGES SAVED mean my article is published?
No. With Editorial Workflow, a saved draft can remain unpublished until the appropriate review and publishing action occurs.
Should I disable Editorial Workflow to fix image errors?
Generally, no. First verify the saved branch, image path, request failure, and deployment state. Disabling Editorial Workflow changes your publication process rather than directly identifying the image problem.
Why does an image sometimes appear after reopening the CMS?
Several possibilities exist, including changes in resource availability, request timing, preview behavior, or browser state. Without request logs and repository evidence, the exact cause cannot be established from the delay alone.
Can I use WebP images with Decap CMS and Astro?
Yes. Decap CMS can manage uploaded WebP files, while Astro can serve those assets. More advanced responsive image generation requires appropriate rendering components or a build-time processing pipeline.
What should I do when Failed to persist entry: [object Object] appears?
Preserve unsaved content, inspect the failed request, verify the GitHub branch, and isolate the operation that fails. The generic error alone does not identify a specific root cause.
Final Thoughts
The most useful lesson from debugging Decap CMS is that a broken preview, a missing production image, and a failed GitHub API request are not necessarily the same problem.
With Git-based publishing, always establish which branch contains your content and whether the deployment includes that branch.
Start with evidence, protect your drafts, and make the smallest necessary change.
A careful troubleshooting process is usually more valuable than immediately replacing working CMS configuration.
Continue Reading
If you’re building an Astro website with Decap CMS, these related tutorials may help:
- How to Build an Astro Blog with Decap CMS and Cloudflare Pages
- Astro SEO Guide 2026: 12 Essential Steps to Optimize Your Website for Google
The troubleshooting experience described here comes from the DuongHoangNam.com project. The observed outcome is documented; the exact root cause of the temporary preview and save failures has not been conclusively established.






