How to debug Toolkit Apps not loading, showing up, missing in the Menus, Shotgun Desktop or the AMIs

Something that comes up from time to time is the issue of figuring out why a given app is not showing.
You may have created a custom app that is not showing, or simply one of the apps wee provide is not showing in the following:

  • In the Shotgun menu in a DCC
  • Shotgun Desktop
  • In the Browser Toolkit action menu items.

There could be a number of reasons. The most likely being that there is a problem with the way you have configured the environment yml files, or that there is a bug with the App its self.

Start by looking at the config, and make sure you have added the app to the correct environment and engine.

Then make sure you’ve enabled debug, reproduce the issue and then look at your logs; depending on what you find in the logs here are some common causes:

  1. You’ve left off the location settings on the app definition inside the environment ymls. All apps must define a valid location. For example, here is the location settings for the loader2 app, although they’ve actually been separated off into a separate file here. In this situation you will likely have an error like this:

    File "/configs/my_config/install/core/python/tank/platform/environment.py", line 115, in __is_item_disabled is_disabled = descriptor_dict.get("disabled", False)
    AttributeError: 'NoneType' object has no attribute 'get'
    
  2. Perhaps there is a syntax error somewhere in the config’s env YAMLs. In this situation, there should be an error in the logs pointing to the location of the syntax issue in the config YAML.

    File "/configs/my_config/install/core/python/tank/util/yaml_cache.py", line 265, in _populate_cache_item_data
    raise TankError("Could not open file '%s'. Error reported: '%s'" % (path, e))
    
    TankError: Could not open file '/sg_toolkit/configs/my_config/config/env/includes/settings/tk-multi-publish2.yml'.
    
    Error reported: 'while scanning for the next token found character '\t' that cannot start any token  in "/configs/my_config/config/env/includes/settings/tk-multi-publish2.yml", line 34, column 1'
    
  3. Perhaps the app encountered an error registering its self. In which case you should search the logs for the following: failed to initialize. It will not be loaded. and there should be an error that explains why.

    2018-08-28 14:28:04,629 [30087 ERROR sgtk.env.project.tk-desktop] App /Users/philips1/source_code/tk-multi-publish2 failed to initialize. It will not be loaded.
    
    Traceback (most recent call last):
    File "/configs/my_config/install/core/python/tank/platform/engine.py", line 2590, in __load_apps
    app.init_app()
    File "/Users/philips1/source_code/tk-multi-publish2/app.py", line 27, in init_app
    a+b
    
  4. The app may not be configured correctly in which case the log may contain a line similar to the one below. The key thing here is search for It will not be loaded and it should give a reason as to why its not been loaded. In this case, our app configuration points to a template that doesn’t exist in the templates.yml.

    App configuration Error for tk-nuke-writenode (configured in environment '/configs/my_config/config/env/shot_step.yml'). It will not be loaded: The Template 'nuke_shot_render_pub_mono' referred to by the setting 'write_nodes' does not exist in the master template config file!
    

Tip:

If you’re having issues debugging a custom app, it’s best to start by adding it to the tk-shell engine and then launching it through the command line using tank. Ie. if you added your app to the tk-shell engine in shot_step.yml environment then you would launch it from tank with something like tank Task 1234 launch_my_app (where 1234 is the ID of the Task on the Shot). If you’re not sure on the command for launching your app you can run tank Task 1234 and it will list out all available app command, as well as any errors it had registering apps.

2 Likes

Bumping this, as it was an old internal post which I’m sharing publicly.