Run randomly hang when adding a "image_url" as additional_messages

I’m using the javascript sdk. This is my call to make a run:

const run = ai.beta.threads.runs.stream(threadId, runConfig);
    run.on("messageDone", (message) => {
        callback(message);
    })
        .on("error", (error: OpenAIError & { status: number }) => {
            logger.error({ error }, "Error returned by OpenAI");
            throw Error;
        })
        .on("abort", () => {
            logger.error("Run aborted");
            throw new Error("Run aborted");
        });

When runConfig contains additional_messages that equate to the following:

[
            {
                role: "user",
                content: [{ type: "text", text: Hello World }, {type: "image_url", image_url: <random_valid_url>,
            },
]

It’ll randomly hang. When I go to the threads UI and view the thread, I see Run failed Invalid image.

I can upload the same image via the UI earlier on in the thread so this would be my second time uploading the same image. Another thing to note, no error message is emitted by the run listener. In fact, the entire thread just hangs and I’m unable to add to it for the next few minutes.

What is going on here?

1 Like