# 500 Internal Server Error with Inference Endpoint

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2F500-internal-server-error-with-inference-endpoint%2F89605%3E%5C
**Category:** Inference Endpoints on the Hub\
**Created:** [May 31, 2024, 1:21pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2F500-internal-server-error-with-inference-endpoint%2F89605 "2024-05-31T13:21:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pwaldron](https://avatars.discourse-cdn.com/v4/letter/p/ebca7d/32.png) [@pwaldron](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fpwaldron)%5C
**Post date:** [May 31, 2024, 1:21pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2F500-internal-server-error-with-inference-endpoint%2F89605%2F1 "2024-05-31T13:21:03Z")

</div>

Hi, I’m very new to this and I’m trying to get an Inference Endpoint working, but I’m encountering a 500 Internal Server Error. The endpoint log has the model initialize successfully, and this error is returned instantly. I’ve tested the EndpointHandler locally and it works locally, returning the expected result.

My handler.py and requirements.txt is here: [https://huggingface.co/pwaldron/conroy-test](https://huggingface.co/pwaldron/conroy-test/tree/main)  
I’m using the following python to test:

```auto
import requests, json
import base64

API_URL = "XXXX"
headers = {
    "Authorization": "Bearer hf_XXXX",
    "Content-Type": "application/json",
    "Accept": "image/png"
}

with open("input.png", "rb") as image_file:
    b64_image = base64.b64encode(image_file.read())

# prepare sample payload
payload = {
    "inputs": "A pencil, donut and apple on a table",
    "image": b64_image.decode("utf-8")
}

def query(payload):
    response = requests.post(API_URL, headers=headers, json=payload)
    return response.content

output = query(payload)
print(output)

```

---

<div class="post-metadata">

**Author:** ![pd-t](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/pd-t/32/27738_2.png) [@pd-t](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fpd-t)%5C
**Post date:** [June 3, 2024, 1:04pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2F500-internal-server-error-with-inference-endpoint%2F89605%2F2 "2024-06-03T13:04:58Z")

</div>

I also see 500 internal server error using the code suggested next to the playground. Is there a server issue?

---

<div class="post-metadata">

**Author:** ![dennis-rall](https://avatars.discourse-cdn.com/v4/letter/d/ce73a5/32.png) [@dennis-rall](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fdennis-rall)%5C
**Post date:** [June 3, 2024, 1:48pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2F500-internal-server-error-with-inference-endpoint%2F89605%2F3 "2024-06-03T13:48:25Z")

</div>

Same for me… And nothing about it in the logs only the analytics page shows the 500 errors

---

<div class="post-metadata">

**Author:** ![pwaldron](https://avatars.discourse-cdn.com/v4/letter/p/ebca7d/32.png) [@pwaldron](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fpwaldron)%5C
**Post date:** [June 4, 2024, 4:21pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2F500-internal-server-error-with-inference-endpoint%2F89605%2F4 "2024-06-04T16:21:49Z")

</div>

Just to share a quick update. I got it to work, but unsure exactly what may have caused the issue. I added the following to the requirements.txt:

- transformers
- diffusers
- accelerate
- mediapipe

After updating the endpoint, it started to work! But after removing them from requirements.txt again and testing on another endpoint, the endpoint just worked anyway! So I’m not sure what changed.

---

<div class="post-metadata">

**Author:** ![pd-t](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/pd-t/32/27738_2.png) [@pd-t](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fpd-t)%5C
**Post date:** [June 4, 2024, 8:35pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2F500-internal-server-error-with-inference-endpoint%2F89605%2F5 "2024-06-04T20:35:17Z")

</div>

@pwaldron n: This has nothing to do with your configuration. An internal server error response when calling the API is of course on the HF side: [Inference API down? - #9 by pd-t](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Finference-api-down%2F89988%2F9)
