erictik / midjourney-api

MidJourney client. Unofficial Node.js client
Apache License 2.0
1.64k stars 269 forks source link

MidJourney error "Sorry! Could not complete the job!" not handled. Imagine stuck indefinitely #244

Open BastienPenalba opened 8 months ago

BastienPenalba commented 8 months ago

the code that reproduces this issue or a replay of the bug

Hello,

I use this package only for Image and Upscale. Most of the time, things a running smoothly, but I sometimes get a MidJourney error like the following:

Capture d’écran 2023-10-30 à 14 43 38

The thing is that in this case the await Imagine(...) never returns anything and seems to stay stuck, not throwing any error:

async function imagineTask(prompt) {
    return await client.Imagine(
        prompt,
        (uri, progress) => {
            console.log("Imagine", uri, "progress", progress);
        }
    );
}

I have the MaxWait setting set at 150, but from what I saw in the code is that it's only used to wait for the message. In my case the message seems to appear so I don't have any timeout error either. I though of handling the timeout myself but I'm affraid the Imagine process will keep running in the background and pile up some errors in the longterm since I don't have any way to cancel the Imagine promise.

Describe the bug

Describe the bug Imagine doesn't throw an error in case of MidJourney failure, neither a timeout

Expected behavior I'd expect client.Imagine(...) to throw an error if MidJourney failed on discord, or at least have some sort of timeout that would cancel the Imagine promise so I can't get a feedback on this error from Discord and handle it properly.

Screenshots

error log

No log since I don't get any error thrown

ManInTheWind commented 6 months ago

same issue encountered, this libarary not handle well at error happed.