# Unexpected 500 response code during execution

**URL:** <https://community.gatling.io/t/unexpected-500-response-code-during-execution/8905>\
**Category:** Gatling (Open-Source)\
**Created:** [April 17, 2024, 12:02pm UTC](https://community.gatling.io/t/unexpected-500-response-code-during-execution/8905 "2024-04-17T12:02:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunil.karki](https://avatars.discourse-cdn.com/v4/letter/s/e495f1/32.png) [@sunil.karki](https://community.gatling.io/u/sunil.karki)\
**Post date:** [April 17, 2024, 12:02pm UTC](https://community.gatling.io/t/unexpected-500-response-code-during-execution/8905/1 "2024-04-17T12:02:57Z")

</div>

I’m executing below code and even when there is no check for status getting unexpected 500 status as status.find.in([200, 209], 304), found 500

````auto
package collectionApis;

import io.gatling.javaapi.core.*;
import io.gatling.javaapi.http.*;
import requestBodies.CollectionRequestBodies;

import static io.gatling.javaapi.core.CoreDsl.*;
import static io.gatling.javaapi.http.HttpDsl.*;

public class VAPayment extends Simulation {

    private final ScenarioBuilder[] scnList = new ScenarioBuilder[5];

    private int users = 1;
    private HttpProtocolBuilder httpProtocol = http
            .baseUrl("https://lannister.uat.creditsaison.xyz")
            .contentTypeHeader("application/json")
            .authorizationHeader("Basic QGRNMU46UEAkJFcwckQ=");

    private void scnList() {
        CollectionRequestBodies vapayment = new CollectionRequestBodies();
       System.out.println(vapayment.VAPayment());

        for (int i = 0; i <= 4; i++) {

            scnList[i] = scenario("VA Payment " + users + "Users")
                    .exec(
                            http("VA Payment " + users + "Users")
                                    .post("/api/v1/axis/notification")
                                    .body(StringBody(vapayment.VAPayment())).asJson());
            users += 1;
        }
    }
    {
        scnList();
        setUp(
                scnList[0].injectOpen(rampUsers(5).during(3))
                        .andThen(
                                scnList[1].injectOpen(nothingFor(15), rampUsers(6).during(3))
                        )
                        .andThen(
                                scnList[2].injectOpen(nothingFor(15), rampUsers(7).during(3))
                        )
                        .andThen(
                                scnList[3].injectOpen(nothingFor(15), rampUsers(8).during(3))
                        )
                        .andThen(
                                scnList[4].injectOpen(nothingFor(15), rampUsers(9).during(3))
                        )

        ).protocols(httpProtocol);
    }
}```
````

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [April 17, 2024, 12:12pm UTC](https://community.gatling.io/t/unexpected-500-response-code-during-execution/8905/2 "2024-04-17T12:12:24Z")

</div>

So? What is your issue?

- why you have a check that consider 500 as a failure? =\> [Gatling HTTP protocol reference - checks](https://docs.gatling.io/reference/script/protocols/http/checks/#http-status)
- why you experience 500 status codes? =\> that’s for you to figure out, that’s a server side failure

---

<div class="post-metadata">

**Author:** ![sunil.karki](https://avatars.discourse-cdn.com/v4/letter/s/e495f1/32.png) [@sunil.karki](https://community.gatling.io/u/sunil.karki)\
**Post date:** [April 18, 2024, 5:05am UTC](https://community.gatling.io/t/unexpected-500-response-code-during-execution/8905/3 "2024-04-18T05:05:41Z")

</div>

Thanks @slandelle for mentioning the implicit checks that gatling does. Actually, we are getting unexpected 500 even though the API response is 200, will have to look at it again.

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/gatling2/original/2X/b/b148e0742de35c6280726cabf3ecd3de2d320f63.png) [@system](https://community.gatling.io/u/system)\
**Post date:** [May 18, 2024, 5:06am UTC](https://community.gatling.io/t/unexpected-500-response-code-during-execution/8905/4 "2024-05-18T05:06:19Z")

</div>

Closed on May 18, 2024, 5:06am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
