Error creating image with OpenAI inside workflow

When I test my workflow, I always get an error. The last time I tried, I got this: {
“message”: “‘MockValSer’ object cannot be converted to ‘SchemaSerializer’”,
“code”: “TypeError”,
“details”: “‘MockValSer’ object cannot be converted to ‘SchemaSerializer’”
}


Hi Ken,

Sorry that your workflow didn’t work earlier – our team has fixed the issue, and you should be able to run it normally now. Please give it another try!

The error happened because when you’re using the Generate Image by OpenAI (DALL·E) action with your OpenAI key, the result returns a special data type that needs custom handling. So, if you’re combining that with the Remove Background by Pixel ML action, make sure the variable you pass looks like this:

{{openai_generate_image.created.data[0].url}}

Alternatively, you can also use the Generate Image by Pixel ML action instead. (Make sure to claim your free Pixel ML key when connecting the action – this gift shows up the first time you connect any Pixel ML-powered action.)

To make it easier for you, here’s a sample workflow I created that you can clone and edit directly into your own workspace:
:backhand_index_pointing_right: Workflow - Generate Image and Remove Background

And for more details, you can check out this Loom video guide:
Loom Video - Generate Image + Remove Background

Thanks again for your patience, and we truly appreciate your support. Our team is always here if you need any help!

Warm regards,
Wendy @ Agenticflow

1 Like