# Error: Request failed with status code 400

**URL:** https://community.openai.com/t/error-request-failed-with-status-code-400/154711
**Category:** API
**Created:** [April 12, 2023, 1:35pm UTC](https://community.openai.com/t/error-request-failed-with-status-code-400/154711 "2023-04-12T13:35:10Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![jamiegalbreath](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/jamiegalbreath/32/71067_2.png) [@jamiegalbreath](https://community.openai.com/u/jamiegalbreath)
#### Post date: [April 12, 2023, 1:35pm UTC](https://community.openai.com/t/error-request-failed-with-status-code-400/154711/1 "2023-04-12T13:35:10Z")

</div>

I am getting “Request failed with status code 400” when running this function createImageEdit() with the official openai SDK in nodejs. Any thoughts?

```auto
    const response = await openai
      .createImageEdit(
        fs.createReadStream("testImage.png"),
        fs.createReadStream("maskImage.png"),
        "A cartoon cute baby otter with blue eyes",
        1,
        "256x256"
      )
      .catch((error) => {
        console.log(error);

        return res.status(200).send({ error: error });
      });

    var image_url = response;

    return res.status(200).send({ test: image_url });

```

---

<div class="post-metadata">

### Author: ![johanmueller](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/johanmueller/32/61721_2.png) [@johanmueller](https://community.openai.com/u/johanmueller)
#### Post date: [April 13, 2023, 2:15am UTC](https://community.openai.com/t/error-request-failed-with-status-code-400/154711/2 "2023-04-13T02:15:55Z")

</div>

Hast du in den Community-Foren gesucht? Schau mal bitte hier.

> [@Request failed with status code 400](https://community.openai.com/t/request-failed-with-status-code-400/39242):
>
> I finally solved it. The values (e.g. temperature) retrieved from environment variables were text, and changing them to numeric types fixed the problem. This was a bug on my side since I changed only this part yesterday. I’m ashamed to admit it, but I’ll leave a record of it for the sake of others to follow. (I’m writing this here because I’ve reached the maximum number of replies.) Suddenly I got this error today, Jan 17, 2023… Until yesterday, our code has been running correctly. Error: R…

---

<div class="post-metadata">

### Author: ![keramat](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/keramat/32/146494_2.png) [@keramat](https://community.openai.com/u/keramat)
#### Post date: [June 4, 2023, 2:03pm UTC](https://community.openai.com/t/error-request-failed-with-status-code-400/154711/3 "2023-06-04T14:03:18Z")

</div>

Have you found a resolution for the 400 error? I get it exactly with createImageEdit as well.

---

<div class="post-metadata">

### Author: ![keramat](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/keramat/32/146494_2.png) [@keramat](https://community.openai.com/u/keramat)
#### Post date: [June 4, 2023, 7:08pm UTC](https://community.openai.com/t/error-request-failed-with-status-code-400/154711/4 "2023-06-04T19:08:21Z")

</div>

I found a solution for creatImageEdit 400 error. It appears that the order of arguments should be image, prompt, mask etc instead of image, mask, prompt etc as described in the documentation.

---

<div class="post-metadata">

### Author: ![EricGT](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/ericgt/32/20571_2.png) [@EricGT](https://community.openai.com/u/EricGT)
#### Post date: [December 18, 2023, 8:44am UTC](https://community.openai.com/t/error-request-failed-with-status-code-400/154711/5 "2023-12-18T08:44:07Z")

</div>


