# How to troubleshoot folder creation errors

**URL:** <https://community.shotgridsoftware.com/t/how-to-troubleshoot-folder-creation-errors/3578>\
**Category:** Pipeline Integrations\
**Tags:** faq, folders, path-cache\
**Created:** [October 29, 2019, 11:32pm UTC](https://community.shotgridsoftware.com/t/how-to-troubleshoot-folder-creation-errors/3578 "2019-10-29T23:32:21Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![tannaz](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/tannaz/32/32_2.png) [@tannaz](https://community.shotgridsoftware.com/u/tannaz)\
**Post date:** [October 29, 2019, 11:36pm UTC](https://community.shotgridsoftware.com/t/how-to-troubleshoot-folder-creation-errors/3578/2 "2019-10-29T23:36:03Z")

</div>

### What’s causing the errors?

Error 1 points to a mismatch between the storage roots as specified in Shotgun (Site Prefs -\> File Management) and `config/core/roots.yml` in the Pipeline Configuration.

It often comes up because of a case mismatch in studios running Windows. Their paths are case-insensitive, but our configs are case-sensitive. A difference as simple as `E:\Projects` vs `E:\projects` can cause this error.

Error 2 seems related, though I’m not exactly sure _why_ it happens. It happens when you’re in a state where you’re trying to create a FilesystemLocation entity for a folder that already has one.

### What’s happening behind the scenes?

In the case of Error 1, I believe what’s happening is this: The code creates the FilesystemLocation entity in Shotgun for the path it just created, using Shotgun’s storage roots to determine the root for the path. Then, it goes to create the same entry in the local cache, and has to determine where to put it in the database. For the local cache, it uses `roots.yml` to determine the root for the path, and because of the case mismatch, the path it generates doesn’t match what was just entered in Shotgun. At this point, it throws the error.

It’s especially bad because it doesn’t error cleanly: the folders are created, the FilesystemLocation entries are created, they are _not_ synced in the local path cache, nor will they ever be able to be synced because of the storage root mismatch.

### How to fix

- _For Error 1 only_, First, make sure the storage root paths in the Site Prefs match the paths in `config/core/roots.yml` . Fixing the mismatch should make the error go away in subsequent folder creation calls.
- _[The rest of the steps apply to both Error 1 and Error 2.]_ Clear the bad FilesystemLocation entities. If you can narrow down to a set of errant FilesystemLocation entities, just remove those. In a lot of cases though, _all_ of the paths for a project are compromised, so they all need to go.
  - How to clear the FilesystemLocation entities: ideally you can run `tank unregister_folders` . To clear all of them, run `tank unregister_folders --all` . (For all the options for `tank unregister_folders` , just run it with no arguments and it will output usage notes.)
  - However, because the db is already in a wonky state, this may not work, or may only partially work. Once you’ve run the command, go back to FilesystemLocations in Shotgun, and confirm that what you expected to be deleted is actually gone. If not, select the bad entities, and move them to trash manually.

- At this point, the FilesystemLocations in Shotgun are clean, but artists’ local caches may not reflect your changes. The last step is to actually sync the local cache on each user’s machine. To do this, they should run `tank synchronize_folders --full` .

Once all those steps are taken, the path cache should be in a good state, and that errors shouldn’t appear anymore.

### Related Links

- Here’s the code in question: [https://github.com/shotgunsoftware/tk-core/blob/01bb9547cec19cc2a959858b09a8b349a388b56f/python/tank/path\_cache.py#L491-L498](https://github.com/shotgunsoftware/tk-core/blob/01bb9547cec19cc2a959858b09a8b349a388b56f/python/tank/path_cache.py#L491-L498)
- What is the path cache? What are Filesystem Locations?: [https://developer.shotgunsoftware.com/cbbf99a4/](https://developer.shotgunsoftware.com/cbbf99a4/)

---

_[View the full topic](https://community.shotgridsoftware.com/t/how-to-troubleshoot-folder-creation-errors/3578)._
