"App init setup failed: a project already exists" MongoDB Realm App

I have an error message that I do know know who to fix regarding Mongodb Realm CLI. https://www.mongodb.com/docs/atlas/app-services/cli/realm-cli-apps-init/

When I write the following command in Terminal:

realm-cli apps init -n test

I get the error message “app init setup failed: a project already exists”

I have already had a project name “test” but I have deleted it (Simply deleting the folder which might have been the mistake) but I still get the error message. The error occurs always, no matter the name or path/folder at the moment.

if realm-cli push is used it seems to use the old “test” application since the name is filled out when going through the [options] https://docs.mongodb.com/realm/cli/realm-cli-push/

If I push the application it will deploy the test application and if deleted through either CLI or GUI it returns to the first problem mention at the start.

Where to go from here? Is the application somehow stored as a draft or something making it impossible for me to create another before its discarded or am I missing something?

Interestingly enough, this issue only happens on my D:\ drive in Windows. No matter what directory I go to in the D drive, it gives me that “App init setup failed…” error. When I go to the C drive, however, I don’t have this issue. I can create multiple projects in different directories with the “realm-cli app init” command. Any idea what’s causing this behavior?

when you use the command to init an app, in the folder you are in, a file named realm_config.json is created with content similar to this:

{
    "config_version": 20210101,
    "name": "test",
    "location": "US-VA",
    "deployment_model": "GLOBAL"
}

This file marks the current folder and all descendant folders as part of the application. It seems you forgot to change to the folder you intended to use and used the command in the root of your D drive instead. To fix the problem, go to your D drive and remove this file.

also, the following folders are created with the init command:

auth
data_sources
environments
functions
graphql
http_endpoints
services
sync
values

create a new app and compare the contents of these folders, make sure they are not part of anything else, like another project, then remove them too to clear the mess. the emphasis here is on “make sure” not to delete precious unrelated data.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.