Could not serialize error when using redis to send messages

Hi, I am using an API to get data and then using redis to send the response to a listener for processing however I am getting an error that says Could not serialize. The procedure works until I uncomment r.rpush(list, json.dumps(message)) command. Please see the below image for my code snipped and also for the error.

def redis_message(list, messages):
for message in messages:
r.rpush(list, json.dumps(message))
except Exception:
return None