Error when getting file from Storage

Which tool versions are you using?

SDK: v14.29.1
Platform: v26.08.3
Python: v3.14
Isolation mode: venv/docker

Current Behavior

Since today we are getting a strange internal error when retrieving a file from storage (from a file type child-entity). Has something been changed? First I thought the file was the issue, but even with uploading a file that last week was successful will fail. Files that have been uploaded earlier are still processed correctly, even when I copy the file type entity.

the error message suggests something is going wrong on your end. It makes our app totally unusable.

error stack trace:
```

Traceback (most recent call last):
  File "viktor_connector/connector.pyx", line 519, in connector.Job.execute
  File "viktor/core.pyx", line 2171, in viktor.core._handle_job
  File "viktor/core.pyx", line 2154, in viktor.core._handle_job._handle_view
  File "viktor/views.pyx", line 2804, in viktor.views.View._wrapper
  File "/home/user/src/app/scia_post_processor/controller.py", line 133, in rcs_design
    self.generate_calculation_sheets(params, entity_name=entity_name, **kwargs),
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/src/app/scia_post_processor/controller.py", line 324, in generate_calculation_sheets
    sections_data_lf = self.preprocess_forces_and_sections(
        params,
    ...<3 lines>...
        ],
    )
  File "/home/user/src/app/scia_post_processor/controller.py", line 225, in preprocess_forces_and_sections
    Storage().get("report_data", scope="entity", entity=child_entity).getvalue_binary()
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "viktor/core.pyx", line 1496, in viktor.core._validate_storage_scope.wrapper
  File "viktor/core.pyx", line 1625, in viktor.core.Storage.get
viktor.errors.InternalError

Can you look into the back-end to have a clearer idea of what is going wrong? I cannot reproduce the issue locally.

I was able to reproduce this locally on WSL. Maybe, that gives a clue on what might be the problem.

Thank you for letting us know. We haven’t done any Platform updates since last week, so I will need to dive a bit deeper to find the culprit. Will let you know in this thread when I know more!

@Wichard

I have been looking at the logs, and I see a lot of Storage().get("report_data", scope="entity", entity=ID) requests for ID’s of entities that no longer exist.

Could it be that someone has deleted the child_entities, but their old entity ID’s are still referenced somewhere?

Or did you happen to delete them when you found out that the Storage() was not working properly?

Hi @kvangiessen,

Thanks for looking into this.

I’ve done some debugging and came to the same conclusion. When we get an entity by its id using API().get_entity(entity_id), the return value is always an Entity object, even if the entity is already removed or does not exist. That was the cause and I was able to fix the problem.

But, I believe that the error is rather vague and can be improved. Because of that, we were looking at the wrong place and assumed the problem is an internal Viktor platform problem.

Is this behaviour (always returning an Entity object) intentional? Or just a bug? In any case, I think the error type and the error message can be improved.

Thank you for reporting and debugging on your side. The behaviour is intentional. get_entity is lazy: it returns a reference that resolves on use. In your case it is never resolved at all, as .id returns the id you passed in, which Storage.get() then sends on.

I agree that the error message is too vague. We will work on both improving the documentation on the lazy behavior as well as the error message on the Storage.get().

Kind regards,

Raoul