Possible Copilot follow-up question issue (due to note names)? #11117
DescriptionGood day, Basically, first question is fine. Second question I then looked in the docker log and: Looks like the first message creates a log, but the second message already cant save it in there anymore. So any follow-up question disappears after answering and it generated errors which show up as notifications as well TriliumNext Version0.105.0 (database: 240, sync protocol: 39) Build: 19.08.2026, 20:07:34, revision: a0908a6 What operating system are you using?Other (specify below) What is your setup?Local + server sync Operating System VersionDocker Error logsCreated new note 'TAjFAkx1Ryaq', branch 'nGwZxG12Fm72_TAjFAkx1Ryaq' of type 'llmChat', mime 'application/json' |
Replies: 10 comments
|
Hi @GitTimeraider! I'm Dosu and I'm helping the TriliumNext team. This looks like a race condition between the chat's auto-rename and the sidebar's content save. Here's what the code shows: The conflict between auto-rename and the pending save
Your log confirms this sequence exactly: Why the sidebar is vulnerable: The This isn't specific to the Copilot provider per se — all providers go through Workaround for now: Refreshing the page after the first message (before sending a second) may help avoid the error, though it's not ideal. The root fix would need the sidebar's save path to either re-fetch the note's current state before writing, or coordinate with To reply, just mention @dosu. Docs are dead. Just use Dosu. |
|
Hi, Are you using a reverse proxy by any chance? And if so, what version? |
Based on the errors im not sure if it has anything to do with it, but for ease I do use nginx 1.30.4,3 |
|
The key is this part of the error: The 400 error can come from somewhere in the environment, that's why I suspected the reverse proxy. Might be worth to check:
|
|
Sure, was focussed on the renaming part as the logging shows it first creating a randomized name, then renaming the note to the first question asked and then failing to save the second question using the non-renamed name. Anyway, never know what influences it so will check it out. Will check what exactly is going in the network tab of the dev tools first thing tomorrow morning, need to get some sleep. Will also see what happens when I go to it with IP |
|
Chat conversations start with the date and then the first message is processed to generate a short title (via a cheap model of the same AI provider). This makes the conversation easy to spot instead of many date-based conversations. The rename is a red herring, it doesn't cause any issues even if it fails (and in your case it succeeded). The 400 you are seeing happens when the server tries to save the conversation, which happens at every step. @dosubot, take notes. The rename cannot possibly cause 400, there is no such thing as a "stale" client state. |
|
Noted and appreciated, @eliandoran — thanks for the correction. I was wrong to suggest a stale-state conflict. Looking at the code, @GitTimeraider, the maintainer's direction is the right one: the 400 is most likely nginx rejecting the request body before it even reaches Trilium. The sidebar chat saves the full message history as a single JSON blob via To reply, just mention @dosu. Share context across your team and agents. Try Dosu. |
400 error that shows up in the network tab. |
|
Skipped the nginx and went directly by IP after having allowed that. |
|
Ok, turns out it was upgrade connection and websocket causing issues. However as those are needed for Trilium, I had the choice between having trilium work or the chat work, not both at the same time with the same nginx settings. Using the NGINX plugin in OPNSense btw. Or in nginx config terms location ^~ /api/llm-chat/stream { So now my Trilium uses my normal nginx settings while specifically the LLM chat uses different ones. So now both of them work fine. |
Ok, turns out it was upgrade connection and websocket causing issues. However as those are needed for Trilium, I had the choice between having trilium work or the chat work, not both at the same time with the same nginx settings.
So while keeping the settings for nginx for general Trilium the same, I created a separate nginx location with some settings adjusted so only the LLM chat would use these nginx settings, not the entirity of Trilium.
Using the NGINX plugin in OPNSense btw.
In the nginx plugin UI you can duplicate the location you use for Trilium, set URL pattern to /api/llm-chat/stream, set match type to dont check regex on longest prefix and disable websockets. Then adjust the ht…