I can't remove domain from pages project and can't delete it (domain "stuck")

I have removed custom domain added to cloudflare pages project

BUT i can’t link this domain to another pages project:
“That domain is already associated with an existing project. Use a different domain or find the project already using this domain and remove it.”

And I can’t delete this project where domain was linked to. I got error while trying to delete project
To delete your project, you must first delete all custom domains associated with your project. (Code: 8000028)

In cloudflare DNS there is no CNAME to pages anymore. I NEED this domain!!

I am facing similar issue and it appears to be a common problem - Cannot remove (project).pages.dev

1 Like

There seems to be an error on my (project).pages.dev where I removed connection with a custom domain, but when i want to remove the pages project then it gives an error

To delete your project, you must first delete all custom domains associated with your project. (Code: 8000028)

I can not delete the project and neither add back the same custom domain into the project. My site is now down due to this issue. I see no way to recover from this issue, to the extent that I have to move away from cloudflare and look for another pages service and keep the pages project hanging. Any pointers will be of great help before I finnaly decide to move out.

Based on the outcomes I see in some similar topics, you may need to use the API to remove the custom domain assignment.

I could use the following script to remove the linkage between custom domain and my pages project. I was able to delete the pages project subsequently.
See Can not delete project at Cloudflare pages r custom domain - #5 by windowfittersltd

1 Like
  • You can get api key from dash.cloudflare.com/profile/api-tokens and navigate to Global API Key.
  • You can get account id from overview page and look for “Account ID”.
  • Email is as registered on account.
# Script to remove custom domain from CloudFlare Pages project.
# GUI on dash.cloudflare.com do not work as expected, so
# resort to use API call directly.
# Author: Neeraj Sharma
# Public Domain
curl --request DELETE \
${https}api.cloudflare.com/client/v4/accounts/$account_id/pages/projects/$project_name/domains/$domain_name" \
--header "Content-Type: application/json" \
--header "X-Auth-Email: ${email}" \
--header "X-Auth-Key: ${api_key}"'
1 Like

Thank you, neerajsharma.9!

This is the most frustrating issue I’ve had with Cloudflare product so far. Please make them visible in the UI, it’s not possible to discover the issue otherwise!