I am working on a react project this morning, and I found I need a new model file for a future function so I just simply copy the other exist model file and rename it. Then, the error shows: app.model: namespace should be unique, the error showing as follows:

The error title told me that I have a duplicate namespace on app.model. I look at the model folder double check the file name and there are unique, so google this error, the reasons are variety, such as,

  • load the same model more than once
  • dynamic register model

but, my error is just simply because I add a ‘namespace’ property in each model file so when I
copy and rename the file, I didn’t change the value for ‘namespace’ in the new file.

After I change the value for the ‘namespace’, the error gone.

If you want to save some energy for this problem, you can just ignore ‘namespace’ in the model file, it will automatically name your model’s namespace as your file name.

Any feedback is welcome! :-)