Skip to content

Conversation

@jrsndl
Copy link
Contributor

@jrsndl jrsndl commented Sep 5, 2025

Ensures that the code gracefully handles cases where the 'data' key is missing or None within the workfile entity. This prevents potential errors and improves the robustness of the workfile processing logic.

Changelog Description

This handles an issue where publish is not able to raise workfile version.

Seems to be workfiles issue, DCC unrelated (Nuke/Maya/Substance)
I was not able to reproduce this error on my machine, but it happened on several artist machines.

Additional info

Relevant traceback:

Traceback (most recent call last):
  File "C:\Users\PSmekal\AppData\Local\Ynput\AYON\dependency_packages\ayon_2406251801_windows.zip\dependencies\pyblish\plugin.py", line 528, in __explicit_process
    runner(*args)
  File "C:\Users\PSmekal\AppData\Local\Ynput\AYON\addons\nuke_0.3.10\ayon_nuke\plugins\publish\increment_script_version.py", line 40, in process
    save_next_version(
  File "C:\Users\PSmekal\AppData\Local\Ynput\AYON\addons\core_1.5.2\ayon_core\pipeline\workfile\utils.py", line 492, in save_next_version
    workfiles = host.list_workfiles(
  File "C:\Users\PSmekal\AppData\Local\Ynput\AYON\addons\core_1.5.2\ayon_core\host\interfaces\workfiles.py", line 1127, in list_workfiles
    version = _data.get("version")
AttributeError: 'NoneType' object has no attribute 'get'

Testing notes:

  1. start with this step
  2. follow this step

Ensures that the code gracefully handles cases where the 'data' key
is missing or None within the workfile entity. This prevents potential
errors and improves the robustness of the workfile processing logic.
@ynbot ynbot added type: bug Something isn't working size/XS labels Sep 5, 2025
@MustafaJafar MustafaJafar added the community Issues and PRs coming from the community members label Oct 30, 2025
@iLLiCiTiT
Copy link
Member

iLLiCiTiT commented Oct 31, 2025

Ensures that the code gracefully handles cases where the 'data' key is missing or None within the workfile entity.

How that can happen? I'm afraid this won't be merged. Those data are must have with workfiles api. The keys might not be there (backwards compatibility) but skipping fetching them is a bug.

@jrsndl
Copy link
Contributor Author

jrsndl commented Oct 31, 2025

Ensures that the code gracefully handles cases where the 'data' key is missing or None within the workfile entity.

How that can happen? I'm afraid this won't be merged. Those data are must have with workfiles api. The keys might not be there (backwards compatibility) but skipping fetching them is a bug.

I do not know how/why this happen, but it does happen on 3 machines with older (~ 1year old) projects. I was not able to find the reason, or why this is not an issue for most workstations, but those few lines helped 3 artists to work, and not crash their pipeline.

I do understand this might be too sketchy, please show me better way to make workfiles more resilient.
Thank you

@iLLiCiTiT
Copy link
Member

It means that you have workfile entity that was not created using api but using SQL because api does validate the value and handle null value.

I do recommend to fix the database. You can use something like this:

import ayon_api

affected_projects = [...]
for project in affected_projects:
    for workfile in api.get_workfiles(project_name, fields={"id", "data"}):
        if workfile["data"] is None:
            ayon_api.update_workfile_entity(project_name, workfile["id"], data={})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Issues and PRs coming from the community members size/XS type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants