TankInitError even after automatic context switching was turned off

Hello everyone,

I have recently distributed a new config with tk-maya’s automatic_context_switch set False.

I hoped it would solve the Tank-related errors that had been shown on user’s Maya Script Editor for a while, but even after the distribution, some reported they still have TankInitError in some occasions: file open, import, custom tools that have file opening process, etc.

I wonder if there is anything I should consider other than automatic_context_switch since I cannot recreate the error on my machine. Is it possible that Shotgun Desktop somehow is reading the old cached configs?



Have you tried clearing the configs on other machines? (delete all cached configs)

Or temporary set %SHOTGUN_HOME% variable somewhere else so you can see if that maybe the problem. (that would tell Desktop to cache in that location instead)


Hi Yu

Are the user’s opening files that live outside of the project that was bootstrapped?

If not I wonder if it’s a path cache issue. Can you try running the following in Maya?

import sgtk
engine = sgtk.platform.current_engine()

Although clearing the cache, like @Ricardo_Musch suggested would have the same effect here.

Do you have multiple PipelineConfiguration entities setup on that project?


Hi @Ricardo_Musch & @philip.scadding,

Thank you for your responses.
Yes, the files are located outside of the project, and the project have four Pipeline Configuration entities.

What I don’t get is that only a few users have reported this after the initial fix (so far only admin or manager who have an access to multiple configs).
Most users have only one config assigned and they haven’t got Tank errors after the initial fix.

I’ll try the methods and let you know how it goes!



Ah OK that error would make sense then. You can only open files from within the project you launched the software with.
Can you give a bit more info about why they are opening files from out side of the project, so I can understand the workflow they are trying to use a bit more?


The users tried to open .ma file in Work folder, which is located outside of the project directory.
Our folder directory is not fully established, and sometimes users put files in their own Work folders; i.e. testing and development.

Speaking of the Toolkit project, I don’t think our configs have any setting that defines the project directory.
Is there any file or entity where we should add a project root path?

I feel something big is missing from the way we’re using the pipeline configs…



Hey @yu-otsuka,

When you set up the project, you would have selected which Shotgun storage root to use and the project folder name.
The project folder name is defined in the Project entity’s tank_name field. The storage roots are defined in your Shotgun site preferences, and you config defines which storage to use in the config/core/roots.yml file.

If you’re are using an advanced setup, which it sounds like you are, then you will have set up a storage root.




Hi Phil,

Thank you for your explanation.

I have realized that our roots.yml has no storage information. Since our config is the semi-hybrid of Basic and Default configs, we must have mistakenly copied the yaml file from Basic.
This must have been causing the Tank errors.

Thanks, Yu

1 Like