Issue

When trying to upload detections via panther_analysis_tool the following error appears:

[INFO]: Uploading items to Panther
Warning: : Exhausted retries attempting to perform bulk upload.

Resolution

If you are uploading Scheduled Queries

Follow the steps in this guide:📄 How to resolve "Bulk upload failed to update a saved query" error in Panther

If you are not uploading Scheduled Queries
import json
# Another option is to use: from ast import literal_eval
# --- Snipped ---
def policy(resource):
  # --- Snipped ---
  recorder = resource_lookup(recorder_name)
  if isinstance(recorder, str):
    recorder = json.loads(recorder)

Cause

This issue can occur when using the --batch option or trying to upload a query that times out or contains an SQL error on a version of panther_analysis_tool that predates v0.19.10.