# Issues with adding default message to gradio chatbot when hosting on Huggingface space

**URL:** <https://discuss.huggingface.co/t/issues-with-adding-default-message-to-gradio-chatbot-when-hosting-on-huggingface-space/135043>\
**Category:** Beginners\
**Created:** [January 9, 2025, 3:37pm UTC](https://discuss.huggingface.co/t/issues-with-adding-default-message-to-gradio-chatbot-when-hosting-on-huggingface-space/135043 "2025-01-09T15:37:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![chanws](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/chanws/32/38905_2.png) [@chanws](https://discuss.huggingface.co/u/chanws)\
**Post date:** [January 9, 2025, 3:37pm UTC](https://discuss.huggingface.co/t/issues-with-adding-default-message-to-gradio-chatbot-when-hosting-on-huggingface-space/135043/1 "2025-01-09T15:37:48Z")

</div>

I am trying to host my chatbot on huggingface space. I encountered this issue whereby when I tried to add the value parameter into the gradio Chatbot, I get a bunch of errors. It works when I try to run locally on my jupyter lab.

snippet of my code below:

conversation\_chain = ConversationalRetrievalChain.from\_llm(llm=llm, retriever=retriever, memory=memory, combine\_docs\_chain\_kwargs={“prompt”: custom\_prompt})

# Define an introductory message

intro\_message = [{“role”: “assistant”, “content”: “Hello! I’m your virtual assistant!”}]

def chat(message, history):  
result = conversation\_chain.invoke({“question”: message})  
return result[“answer”]

# Gradio Chat Interface

view = gr.ChatInterface(  
fn=chat,  
chatbot = gr.Chatbot(avatar\_images=[“guru.png”, “guru.png”], type=“messages”, **value=intro\_message** ),  
type=“messages”  
)

# Launch the app

if **name** == “ **main** ”:  
view.launch()

Error message shown on huggingface spaces logs below:

ReferenceError: scroll is not defined  
at file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index55-D5oefuYR.js:869:9  
at each (file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ssr-RaXq3SJh.js:388:10)  
at file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index55-D5oefuYR.js:835:335  
at Object.$$render (file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ssr-RaXq3SJh.js:423:16)  
at Object.default (file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index55-D5oefuYR.js:1064:62)  
at file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/2-CClG50To.js:14423:65  
at file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/2-CClG50To.js:14424:5  
at Object.$$render (file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ssr-RaXq3SJh.js:423:16)  
at file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index55-D5oefuYR.js:1028:48  
at Proxy.$$render (file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ssr-RaXq3SJh.js:423:16)  
ReferenceError: scroll is not defined  
at file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index55-D5oefuYR.js:869:9  
at each (file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ssr-RaXq3SJh.js:388:10)  
at file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index55-D5oefuYR.js:835:335  
at Object.$$render (file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ssr-RaXq3SJh.js:423:16)  
at Object.default (file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index55-D5oefuYR.js:1064:62)  
at file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/2-CClG50To.js:14423:65  
at file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/2-CClG50To.js:14424:5  
at Object.$$render (file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ssr-RaXq3SJh.js:423:16)  
at file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index55-D5oefuYR.js:1028:48  
at Proxy.$$render (file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ssr-RaXq3SJh.js:423:16)  
ReferenceError: scroll is not defined  
at file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index55-D5oefuYR.js:869:9  
at each (file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ssr-RaXq3SJh.js:388:10)  
at file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index55-D5oefuYR.js:835:335  
at Object.$$render (file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ssr-RaXq3SJh.js:423:16)  
at Object.default (file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index55-D5oefuYR.js:1064:62)  
at file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/2-CClG50To.js:14423:65  
at file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/2-CClG50To.js:14424:5  
at Object.$$render (file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ssr-RaXq3SJh.js:423:16)  
at file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index55-D5oefuYR.js:1028:48  
at Proxy.$$render (file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ssr-RaXq3SJh.js:423:16)  
ReferenceError: scroll is not defined  
at file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index55-D5oefuYR.js:869:9  
at each (file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ssr-RaXq3SJh.js:388:10)  
at file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index55-D5oefuYR.js:835:335  
at Object.$$render (file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ssr-RaXq3SJh.js:423:16)  
at Object.default (file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index55-D5oefuYR.js:1064:62)  
at file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/2-CClG50To.js:14423:65  
at file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/2-CClG50To.js:14424:5  
at Object.$$render (file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ssr-RaXq3SJh.js:423:16)  
at file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index55-D5oefuYR.js:1028:48  
at Proxy.$$render (file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ssr-RaXq3SJh.js:423:16)  
ReferenceError: scroll is not defined  
at file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index55-D5oefuYR.js:869:9  
at each (file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ssr-RaXq3SJh.js:388:10)  
at file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index55-D5oefuYR.js:835:335  
at Object.$$render (file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ssr-RaXq3SJh.js:423:16)  
at Object.default (file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index55-D5oefuYR.js:1064:62)  
at file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/2-CClG50To.js:14423:65  
at file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/2-CClG50To.js:14424:5  
at Object.$$render (file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ssr-RaXq3SJh.js:423:16)  
at file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index55-D5oefuYR.js:1028:48  
at Proxy.$$render (file:///usr/local/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ssr-RaXq3SJh.js:423:16)  
Traceback (most recent call last):  
File “/home/user/app/app.py”, line 103, in

Anybody encountered this before?

---

<div class="post-metadata">

**Author:** ![Alanturner2](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/alanturner2/32/37542_2.png) [@Alanturner2](https://discuss.huggingface.co/u/Alanturner2)\
**Post date:** [January 10, 2025, 2:26am UTC](https://discuss.huggingface.co/t/issues-with-adding-default-message-to-gradio-chatbot-when-hosting-on-huggingface-space/135043/2 "2025-01-10T02:26:05Z")

</div>

There is no error in your code. I can run your code successfully.  
What’s your problem?

---

<div class="post-metadata">

**Author:** ![chanws](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/chanws/32/38905_2.png) [@chanws](https://discuss.huggingface.co/u/chanws)\
**Post date:** [January 10, 2025, 4:20am UTC](https://discuss.huggingface.co/t/issues-with-adding-default-message-to-gradio-chatbot-when-hosting-on-huggingface-space/135043/3 "2025-01-10T04:20:33Z")

</div>

Thanks for taking your time to troubleshoot my problem. Have you tried running it on huggingface space? I had errors when doing so but it works fine when I run it locally in my jupyter lab.

---

<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:** [January 10, 2025, 7:08am UTC](https://discuss.huggingface.co/t/issues-with-adding-default-message-to-gradio-chatbot-when-hosting-on-huggingface-space/135043/4 "2025-01-10T07:08:11Z")

</div>

I haven’t seen this error myself, but the error message does include SSR. It’s possible that the **SSR\_MODE** in Gradio 5 is causing some kind of bug. Try setting the Gradio version to 4.44.0 in **README.md**.  
If you want to use 5, change **view.launch()** to **view.launch(ssr\_mode=False)**.  
Or, if you’re using 5.11.0, the bug may have been fixed.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png) [@system](https://discuss.huggingface.co/u/system)\
**Post date:** [January 10, 2025, 7:08pm UTC](https://discuss.huggingface.co/t/issues-with-adding-default-message-to-gradio-chatbot-when-hosting-on-huggingface-space/135043/5 "2025-01-10T19:08:25Z")

</div>

Closed on January 10, 2025, 7:08pm UTC

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