Chat with RTX "Invalid session. Reopen RTX Chat from desktop to continue chatting."

I’ve installed the Chat with RTX demo successfully multiple times and on different drives, including the default folder. However, every time I’ve launched the demo, the browser window opens and says “Invalid session. Reopen RTX Chat from desktop to continue chatting.” I am not sure what the root cause of this issue is.

Specs:
Windows 11 Pro 22631.3155
RTX 4090, Driver Version 551.52

Please see: Chat with RTX Installation Failure

Hi @TomNVIDIA

Thanks for the suggestion.

Not sure if @svelury solved the issue or not. I originally installed to none default folder and got the issue; then I changed to install to default directory by doing ‘clean install’, but the problem still persists.

Windows 11 Pro 22621.3155
RTX 4090, Driver Version 551.52

1 Like

@TomNVIDIA
My current installation is in the default folder, but the issue remains.

1 Like

I don’t really know what is the deeper issue that is causing this bug, or if it’s just that nvidia didn’t catch the bug. anyway, the following fixes the surface issue and allows the interface to open properly:
First find this file:
C:\Users\{Your user dir}\AppData\Local\NVIDIA\ChatWithRTX\RAG\trt-llm-rag-windows-main\ui\user_interface.py
Find the context of line 298.
Place the following line of code:

key, value = cookie.split(‘=’)

Replace with:

split_index = cookie.find(‘=’)
key, value = cookie[:split_index], cookie[split_index+1:]

Save file and restart application.
Remember to take care to make sure the indentation is the same, python is sensitive to this.
The reason why I’m providing the bug fix here is because I don’t really know how to make a community contribution to this RTX Chat from Nvidia.
Anyway the problem with this bug is that nvidia’s code tries to split a cookie directly into strings by ‘=’, but there are times when there is more than one = in the string, such as a ‘=’ that is included by a “”, which causes the 'key, value = ’ code to try to unwrap an array larger than 2.

4 Likes

Hi @ryan_sg,

I have shared this with the team.

Thanks,
Tom

Hi,

The solution does not work if you put “Share=true” to create a public URL or specify server name in the Launch() to be 0.0.0.0 inside “user_interface.py”

you still get the issue “Invalid session. Reopen RTX Chat from desktop to continue chatting.” when u access the public URL from other PC or from other PC on LAN if you are setting servername to 0.0.0.0

I was able to fix this by clearing the cache and cookies in my browser. The session now starts fine, but I am not sure if this is a temporary fix.

1 Like

Ok I fixed this by adding the cookie URL at the end of the URL. Now it works fine

Thanks @svelury
Clearing cache works for me.

what do you mean by cookie url? can you please show what you did?

I followed this article:

thank you for the answer. I have also followed that guide, but i still have the same problem. invalid Session when accessing over LAN, it works as expected locally.

this is my edit:
for i, cookie in enumerate(cookies):
split_index = cookie.find(‘=’)
key, value = cookie[:split_index], cookie[split_index+1:]
if key == ‘s_chat’:
session_key = value

are you using local or public sharing?

just use the output url with cookie like this:
Open http://xxxxxx?cookie=xxxxxxxxxx__theme=dark in browser to start Chat with RTX
change ip to you lan ip

2024/march/10 i had the invalid session and i just delete this row of code, after so it never poped out (i have apsolte no idea what problem it has but i mean now can i just browse it by lan


)

2 Likes

Easiest way to fix it I could find on my side:

  • Close all screens related to Chat with RTX.

  • Open with your favorite text/code editor this file:
    C:\Users%USERPROFILE%\AppData\Local\NVIDIA\ChatWithRTX\RAG\trt-llm-rag-windows-main\ui\user_interface.py

  • Find the following entry:
    key, value = cookie.split(‘=’)

  • Change this entry to:
    key, value = cookie.split(‘=’, 1)

  • Save the file and run Chat with RTX again

This should do the trick.

Hi @cafasdon i did what you suggested and got this error:

 Traceback (most recent call last):
  File "D:\ChatWithRtx\RAG\trt-llm-rag-windows-main\app.py", line 35, in <module>
    from ui.user_interface import MainInterface
  File "D:\ChatWithRtx\RAG\trt-llm-rag-windows-main\ui\user_interface.py", line 290
    key, value = cookie.split(�=�, 1)
                              ^
SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0x91 in position 0: invalid start byte
Press any key to continue . . .

i have no idea of coding how do i fix this?

Just to confirm that as of May 2024 I was getting this error as well and a reboot and clearing of my browser cache solved the issue for me.