# Stopiteration error

**URL:** <https://discuss.huggingface.co/t/stopiteration-error/155463>\
**Category:** 🤗Transformers\
**Created:** [May 16, 2025, 4:01am UTC](https://discuss.huggingface.co/t/stopiteration-error/155463 "2025-05-16T04:01:20Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [May 16, 2025, 10:14am UTC](https://discuss.huggingface.co/t/stopiteration-error/155463/2 "2025-05-16T10:14:57Z")

</div>

Maybe same or similar case.

> [@Facing issue using a model hosted on HuggingFace Server and talking to it using API\_KEY](https://discuss.huggingface.co/t/facing-issue-using-a-model-hosted-on-huggingface-server-and-talking-to-it-using-api-key/154529):
>
> I am trying to create a simple langchain app on text-generation using API to communicate with models on HuggingFace servers. I created a “.env” file and stored by KEY in the variable: “HUGGINGFACEHUB\_API\_TOKEN” I also checked it, API token is valid. Post that, I tried running this code snippet: from langchain\_huggingface import ChatHuggingFace, HuggingFaceEndpoint from dotenv import load\_dotenv load\_dotenv() llm = HuggingFaceEndpoint( repo\_id="TinyLlama/TinyL…

---

_[View the full topic](https://discuss.huggingface.co/t/stopiteration-error/155463)._
