Getting a crash using multi-workfiles missing task template

Hi I think I am hitting a bug, and I am unclear why it’s popping up.

It looks like when I have only 1 shot and that shot is missing a task template this triggers maybe?
I’m not 100% sure on the cause, hopefully someone here can give me a hand if it’s obvious on your side.

Basically the shotgun_model that is returning data for the File Open form is hitting a KeyError and crashing nuke.

The location of the KeyError is here: tk-framework-shotgunutils/master/python/shotgun_model/shotgun_model.py

Here is the traceback:

Traceback (most recent call last):
  File "/opt/shotgun_cache/dpoe/archplatform/p124c1.basic.desktop/cfg/install/core/python/tank/platform/engine.py", line 1685, in _create_widget
    widget = derived_widget_class(*args, **kwargs)
  File "/opt/shotgun_cache/dpoe/bundle_cache/app_store/tk-multi-workfiles2/v0.12.3/python/tk_multi_workfiles/file_open_form.py", line 47, in __init__
    FileFormBase.__init__(self, parent)
  File "/opt/shotgun_cache/dpoe/bundle_cache/app_store/tk-multi-workfiles2/v0.12.3/python/tk_multi_workfiles/file_form_base.py", line 70, in __init__
    self._entity_models = self._build_entity_models()
  File "/opt/shotgun_cache/dpoe/bundle_cache/app_store/tk-multi-workfiles2/v0.12.3/python/tk_multi_workfiles/file_form_base.py", line 241, in _build_entity_models
    bg_task_manager=self._bg_task_manager,
  File "/opt/shotgun_cache/dpoe/bundle_cache/app_store/tk-multi-workfiles2/v0.12.3/python/tk_multi_workfiles/entity_models/extended_model.py", line 71, in __init__
    entity_type, filters, hierarchy, fields, *args, **kwargs
  File "/opt/shotgun_cache/dpoe/bundle_cache/app_store/tk-framework-shotgunutils/v5.7.6/python/shotgun_model/shotgun_entity_model.py", line 84, in __init__
    self._load_data(entity_type, filters, hierarchy, fields)
  File "/opt/shotgun_cache/dpoe/bundle_cache/app_store/tk-framework-shotgunutils/v5.7.6/python/shotgun_model/shotgun_model.py", line 386, in _load_data
    None, root, self._create_item
  File "/opt/shotgun_cache/dpoe/archplatform/p124c1.basic.desktop/cfg/install/core/python/tank/log.py", line 514, in wrapper
    response = func(*args, **kwargs)
  File "/opt/shotgun_cache/dpoe/bundle_cache/app_store/tk-framework-shotgunutils/v5.7.6/python/shotgun_model/data_handler.py", line 272, in generate_child_nodes
    factory_fn(parent_object, data_item)
  File "/opt/shotgun_cache/dpoe/bundle_cache/app_store/tk-framework-shotgunutils/v5.7.6/python/shotgun_model/shotgun_model.py", line 622, in _create_item
    self._update_item(item, data_item)
  File "/opt/shotgun_cache/dpoe/bundle_cache/app_store/tk-framework-shotgunutils/v5.7.6/python/shotgun_model/shotgun_model.py", line 660, in _update_item
    {"name": data_item.field, "value": data_item.shotgun_data[data_item.field]},
KeyError: 'entity.Shot.sg_sequence.Sequence.episode'

The entity.Shot.sg_sequence.Sequence.episode field was not present in the data that was queried from Shotgun. Most likely the query contains a set list of fields, or ones obtained from the context. Actually you can see here how the field list is created. Perhaps there’s more to it than I’m seeing right now.

Can’t remember if two-level-deep references like this work at all.

Hey Mois,

I think I’m daft, I just realized that’s in my workfiles config… and the project I had linked it to didn’t have episodes.

This is 100% my fault :confused:

Thanks for your help, it made me run a find on my config which lead me to my own fault :stuck_out_tongue:
-Alex