decap-cms: Cannot save changes (API_ERROR: Reference update failed - "UNPUBLISHED_ENTRY_PERSIST_FAILURE")

Describe the bug

I am getting an error when I try to save some changes in the CMS of a site deployed on Netlify. The error I get when I make a change and click the Save button is this: Failed to persist entry: API_ERROR: Reference update failed

To use GitHub as the authentication method for the CMS (so that my GitHub user can login into the CMS), I followed the instructions of the docs. The configuration can be seen here: https://github.com/Petrolog-IT/one-click-hugo-cms/blob/master/site/static/admin/config.yml

backend:
  name: github
  repo: Petrolog-IT/one-click-hugo-cms
  branch: master

As the docs mentioned, I created an OAuth app on GitHub and added the Client ID and Secret in the appropriate settings page of Netlify:

image

I can login into the CMS of the site deployed on Netlify with the Petrolog-IT GitHub user successfully. I can also delete things from the CMS successfully. But I cannot save any changes.

To Reproduce

Expected behavior

Create a commit with the changes.

Screenshots

image

Applicable Versions:

  • Netlify CMS version: 2.9.7
  • Git provider: GitHub
  • OS: Ubuntu Xenial 16.04
  • Browser version Version 75.0.3770.142
  • Node.JS version:

CMS configuration

https://github.com/Petrolog-IT/one-click-hugo-cms/blob/master/site/static/admin/config.yml

Additional context

These related issues didn’t help:

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (9 by maintainers)

Most upvoted comments

I added this to the list of API_ERROR solutions and workarounds: https://github.com/netlify/netlify-cms/issues/2827

This is solved by deleting the cms branch from the repo. I remember it from a previous issue. I’ll check why having a branch with that name breaks editorial workflow

Having the same issue. I can save entries if i disable the editorial workflow though

Hi @erezrokah, I deleted the cms branch and it is working like a charm!

You guys are awesome! Thank you very much for your help.

Happy holidays!

This is a git restriction when creating branches. You can easily reproduce locally by doing:

git branch cms
git branch cms/foo

In order to prevent such cases in the future we will need to change our branch naming scheme, possibly as a part of https://github.com/netlify/netlify-cms/issues/1669.

Closing this, @Petrolog-IT please re-open with a link to the repo+network traffic if issue persists. @robinsingh-bw, @jimmyangel please comment if the workaround of deleting the cms branch doesn’t work for you