-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot read properties of undefined (reading 'role') #3732
Comments
Very confusing, I got the same error again.chat feature can't work
I mainly did the following operations, and this error occurred :
so,this means that the problem is not in the code project directory, but exists in some kind of public cache? This cache will be used during compilation, which may cause errors ? Even in the new cloned folder . Does the session or history exist in the cache of IntelliJ or Gradle?? I suspect that it was the failed chat that caused the plugin to fail to record the session properly, or an error occurred in the history record, causing this problem,Because I have rolled back the code to the last submission,The only difference is that before fallback code, there was a chat failure error in chat test Even if I rolled back the code, when I sent the question again, the plugin might read the previous record from the session or history, and it could not read it properly, resulting in the error that the role could not be found So, it seems that if a chat fails unexpectedly, the role error will appear the next time the question is sent. I think history and session exists in the This is my speculation, maybe the problem is not caused by history, please help to check it ,I know I often disturb you guys, Im so sorry, but I have encountered this problem many times, I hope it can be taken seriously |
Some debug reference information I think it is the reason of this issue , but maybe the code I checked below is not necessarily the cause of the problem, FYI: According the error message , I tried to find the location of the error code, it is in \binary\out\index.js:1627:1562,
After searching, I found that this code exists in core\llm\countTokens.ts Line 398
|
And , When I close the roles error message window and send the question again and again for many tests , sometime the role error message will not show , but the streaming API request only return only the first chunk data, then the request is stopped. but sometimes role error appear, not call API ,so maybe this behavior seems really weird. It seems maybe two different phenomena caused by the same root problem. when the the role error message not show,The message I post to API : only return a word "good" , then Stream request was stopped,It seems that the plugin actively closes the stream Actually, before you made this fix, my code was working fine (step 1 in my previous commit). If the code is indeed no problem, is it possible that a compilation cache errors exists in may local , causing me to build incorrect results even though I use new code later, leading to this problem? |
@fulco813 |
I just did a test to verify my guess that "some kind of wrong compilation cache" caused the error ,FYI
For comparison:
Log of Run Extension, you can see something like the following, the compilation is from cache:
As you can see, there are some FROM-CACHE, which shows that it is compiled from the cache. Even if I clone the same dev_old branch code in another folder, it seems to still build the same result. But in the Through this phenomenon, I can think of two possibilities:
If the React App State data of the GUI is cached, then the state may store broken/incorrectly formatted/wrong history session data. When an unexpected error occurs (such as filter error), the wrong session history data reads the history to build the chat data, resulting in msg being an empty array, a role error. 2 Gradle-related dependency packages are stored in C://username/.gradle of windows computer It seems to be shared by all projects. As long as the gradle-related configuration uses the corresponding dependency package, it will be obtained from here. Maybe my idea is completely wrong, just for reference information |
My latest debug information, hope it helps: I found that when role error occurs, history is obtained from session in this code, but get the empty array updatedHistory = [ ] Therefore, the history in the messages variable constructed by the constructMessages method is also empty, causing the subsequent streamNormalInput method to use an empty message My idea is, if there has been an unexpected error chat, there is no exception handling, and the wrong session is recorded (such as #3782, I had the role error after this 'filter' error) After this, even if I rebuild/restart the plugin, the session still exists and get empty array updatedHistory = [ ] when send question,so can't find role in empty history array |
Now I think it is indeed some kind of session cache in the plugin, because I found that when I deleted the entire folder But when I packaged the new code as installation zip package , and installed it again in an intellij IDEA, the old chat data was still displayed ! This means that the old session data is not stored in This makes me more suspicious that the role problem is due to an unexpected chat error , and a broken session has been stored, so when a new question is asked, an empty array is obtained when obtaining the history message, and the role cannot be read. |
@RomneyDa I believe this may be related to a session titles bug you recently fixed? |
Hi , @RomneyDa Thanks you! Could you please give a brief explanation of what caused this role error? Because it feels so strange...When I was testing, I found that if I ignored this role error and sent the question again, there is a certain probability that the role error will not occur, but the stream request will only return the first data fragment and then the stream will be stopped, and no return data will be displayed in the UI. Then I cloned code to a new folder again and started local debugging. This problem did not occur, everything good. But after I packaged it into an installation package and sent it to a friend to install it in intellij, he role error appeared again on his computer. |
I may have found a temporary solution to this issue, as I mentioned before, I suspect the plugin has some kind of cache, installed the plugin again. the previous chat history was still displayed again(Chat was available before), so I want to clear the cache manually because I think there may be some corrupted cache that caused this role problem and the problem of the stream being terminated for unknown reasons Then I found , In my project folder opened by IntelliJ, there is a So I try to delete this file, and installed the plugin again, the Chat feature running good without any problems. But I see that the contents of this zip package are the same as the installation package. Maybe its existence will cause some errors in IntelliJ cache? |
I don't think this is related to the session title. When the chat is error, the session title generated in the chat history panel. |
@AfterStories you're still getting the |
@AfterStories you were right, the above PRs fixed messaging logic but not this specific error. This one is fixed here per your bug find |
Thank you so much for your still attention to this report. I noticed that in https://github.com/continuedev/continue/pull/3884/files, you enhance the readability of the msgs array. I'm glad to see your reply. and now I'm currently on holidays, so I think I will do more tests to verify this fix, maybe next week. I still suspect the root cause of the problem is: why does it generate such an empty msgs array when running in IntelliJ? The same code in core layer, the plugin running in vscode has never occurred this problem. Because as I mentioned above, this problem is likely to probabilistic, not sure whether just enhancing the readability in countTokens.ts can really solve the root problem. |
Before submitting your bug report
Relevant environment info
Description
I ran the latest code and when trying to talk to the local model I got the following error:
And when I run [Start Core Dev Server],I got this error:
To reproduce
No response
Log output
The text was updated successfully, but these errors were encountered: