Skip to content

Using find() and ordering by playlists.PlaylistVersionConnection.sg_sort_order returns CRUD ERROR #288

Open

Description

@blerrgh

The following code:

shotgun.find(
    "Version",
    order=[{"field_name": "playlists.PlaylistVersionConnection.sg_sort_order", "direction": "asc"}],
)

Results in the following error:

shotgun_api3.shotgun.Fault: API read() CRUD ERROR #10: Read failed for entity type [Version]

This is probably an issue on the server side rather than the python api client, but I would expect to be able to sort by the Playlists > Sort Order field though the API in the same way you can through the UI.

Activity

  1. blerrgh commented on Jun 11, 2023

    @blerrgh
    Author

    More specifically, this is an issue because when the UI is sorted by Playlist -> Sort Order and an Action Menu Item is triggered, the POST payload from Shotgrid includes sort_column: playlists.PlaylistVersionConnection.sg_sort_order

    However, querying the API using that sort column triggers this ambiguous CRUD error.

    I would expect any sort_column value that is provided by Action Menu Items or Webhooks to be valid a sort order field for an api find() query, but that doesn't always seem to be the case.

    At the very least, it would be nice if the error message was more descriptive.

  2. edi-spaghetti commented on Oct 22, 2026

    @edi-spaghetti

    A developer was asking me about this issue again today, so I am posting a workaround for future reference.

    You cannot query 'playlists.PlaylistVersionConnection.sg_sort_order' directly, however you can query the PlaylistVersionConnection directly and then stitch the data back together client-side e.g.

    result = sg.find('PlaylistVersionConnection', [['playlist.Playlist.id', 'is', 36006]], ['playlist', 'version', 'sg_sort_order'], order=[{'field_name': 'sg_sort_order', 'direction': 'asc'}])
    versions = [r['version'] for r in result]
    

    Since the 'version' field is linked, you could also use dot notation to get any relevant fields from the versions if you want your list of versions to contain more info.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions