Batch index failed 0 or 1 based

Hi,

On Shotgun Batch, when it failed we receive this error:
Fault: API batch() request with index 17 failed. All requests rolled back.

My question is: this index is 0 or 1 based (on Python, the list are 0 based)

Thanks for your answer, it will help to report a more detailed error.

Regards

2 Likes

Hey @nicolas.p,

Welcome to the forums! I agree, that error message makes no sense, and doesn’t help you to track down the issue in a timely manner. I’m fairly certain the index is zero based, but I’ll double check with the engineers and report back.

1 Like

Hi @nicolas.p,

I can confirm that this is 0 based:

>>> sg.batch(
...  [
...     {
...         "request_type": "create", "entity_type": "Shot", "data": {
...             "code": "shot_0001",
...             "project": {"type":"Project", "id":91}
...         }
...     },
...     {
...         "request_type": "create", "entity_type": "Shot", "data": {
...             "code": "shot_0002"
...         }
...     }
...  ]
... )
Traceback (most recent call last):
  File "<stdin>", line 11, in <module>
  File "/Users/pboucher/Dev/shotgun/src/alfred-sg-tools/src/shotgun_api3/shotgun.py", line 1506, in batch
    records = self._call_rpc("batch", calls)
  File "/Users/pboucher/Dev/shotgun/src/alfred-sg-tools/src/shotgun_api3/shotgun.py", line 3186, in _call_rpc
    self._response_errors(response)
  File "/Users/pboucher/Dev/shotgun/src/alfred-sg-tools/src/shotgun_api3/shotgun.py", line 3482, in _response_errors
    raise Fault(sg_response.get("message", "Unknown Error"))
shotgun_api3.shotgun.Fault: API batch() request with index 1 failed.  All requests rolled back.
API create() missing 'project' attribute:
[{"field_name"=>"code", "value"=>"shot_0002"}]
1 Like

Hi Patrick

Le ven. 20 mars 2020 à 18:30, Patrick Boucher via Community @ Shotgun shotgunsoftware@discoursemail.com a écrit :

Thanks for your answer and sorry for the late reply and to have sended this answer too quickly

:slight_smile:

Le ven. 27 mars 2020 à 14:45, Nicolas PASTRANA nicolas.p@amusenetwork.com a écrit :

1 Like

My pleasure, il n’y a pas de quoi, Nicolas.

2 Likes