Error "Cannot read properties of undefined (reading 'toolCalls')"

Hello, I’m not a developer, but these errors don’t stop me from developing any application.

Bolt doesn’t want to know anything, impossible to continue the conversation.

This happens with any llm.

Cannot read properties of undefined (reading 'toolCalls')
    at Object.flush (file:///Users/geekster/Documents/bolt.diy/node_modules/.pnpm/ai@4.0.26_react@18.3.1_zod@3.24.1/node_modules/ai/core/generate-text/stream-text.ts:675:33)
    at ensureIsPromise (node:internal/webstreams/util:185:19)
    at transformStreamDefaultSinkCloseAlgorithm (node:internal/webstreams/transformstream:569:5)
    at Object.close (node:internal/webstreams/transformstream:366:14)
    at ensureIsPromise (node:internal/webstreams/util:185:19)
    at writableStreamDefaultControllerProcessClose (node:internal/webstreams/writablestream:1144:28)
    at writableStreamDefaultControllerAdvanceQueueIfNeeded (node:internal/webstreams/writablestream:1224:5)
    at writableStreamDefaultControllerClose (node:internal/webstreams/writablestream:1191:3)
    at writableStreamClose (node:internal/webstreams/writablestream:701:3)
    at writableStreamDefaultWriterClose (node:internal/webstreams/writablestream:1073:10)
    at writableStreamDefaultWriterCloseWithErrorPropagation (node:internal/webstreams/writablestream:1065:10)
    at node:internal/webstreams/readablestream:1525:15
    at complete (node:internal/webstreams/readablestream:1404:9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5

Please help me if you have already encountered this type of error.

Sincerely

Hi @bakkula,

can you please provide more details, what you are trying to do and what you testet.

Easiest way => Export your chat history and provide it to us, so we can see what you are trying to do:
image

Hi, I just tried to make an improved shopping list app.

The problem is that this error message also appears when trying other more or less complex applications.

Chat history error “toolCalls”

Thanks for your help

Hi,
I am by far no frontend expert but tried out quickly what I thought is the problem.
It tries using vite-plugin-pwa within the container and this is not working and also makes no sense in my view. This is something you may need for the build/production version.

So remove this line:

In the Terminal do manually a rm -rf node_modules

install and start again

npm install
npm run dev

now it should work (did it for me)

If it works you should also prompt it / tell it the ai to fix it, cause otherwise its not persistet and it will do it again (manual changes are not persistet at the moment)

In general I would suggest you to use english language for your prompts, cause I am pretty sure most training data is english and even they can handle other languages, I think the best results you will get with english prompts.

Hello,

Thank you very much for your help, I thought it would work but I have a new error message after deleting the lines that concern quickly pwa.

Also, when I try to chat, the ia doesn’t work and I get an error in the bottom right corner of bolt, (There was an error processing your request: An error occurred.)

And in the conversion, whatever the message, I get these errors.

Error occurred at /
Port: 5173

Stack trace:
DataCloneError: Failed to execute 'postMessage' on 'MessagePort': Symbol() could not be cloned.
    at .localservice@runtime.1b4252dd.js:1:12697
    at new Promise (<anonymous>)
    at _0x10b068 (.localservice@runtime.1b4252dd.js:1:11849)
    at Object.apply (.localservice@runtime.1b4252dd.js:1:9765)
    at _0x13fc87 (.localservice@runtime.1b4252dd.js:26:34970)
    at _0xa708ee (.localservice@runtime.1b4252dd.js:26:35715)
    at console.<computed> [as error] (.localservice@runtime.1b4252dd.js:26:34363)
    at handleSearch (src/App.jsx:78:15)

Thanks for your help and advice

hi, your welcome :slight_smile:

This likely happens when the project gets bigger and the LLM cannot handle it anymore. If you read other topics here, you see, this happens often and I explained it several times, why.

So mostly it works when using Google Gemini 2.0 Flash, but can also happen it begins to do crap (as you also can see in my recent published youtube video - see my profile for link).

Anyway, I can check your project again, if you upload the current chat history. Just to make sure, its not an other issue.

PS: Please use formatting in messages here => I edited yours to highlight the errors correctly :slight_smile:

However, I’m not asking him to work on a very complex project… it’s a simple, improved ToDo LIst application. I use deepseek with Bolt, but it gives the same result with gemini.

I’ve just started to play with ia no code as a non-developer, and I’m sure I’ve done some things wrong. I’m learning as I go.

Generally, what I do when I launch Bolt is to open the browser console next to it and paste any errors into the conversation so that the AI can try to correct them for me.

I’ve uploaded the chat history.
–REMOVED BECAUSE CONTAINS SENSITIVE DATA-- (by @leex279)

Sorry about the formatting for the code, I’ll look at how to add the code correctly next time, thanks for editing.

Important: Your chat history / code contains your API key for deepseek. You should never share sensitive data. I would recommend not hardcode the API key within the code. Use either environment variables or do it as I do in my advanced task list => make it configurable in settings within the app it self:
https://task-list-advanced.netlify.app/

Actual Problem:
Your API key is not working, which you can see by this error in the console:

If you lookup the statuscode in deepseek api docs, you see this:

=> This is nothing bolt can fix for you, when providing credentials which are not valid :slight_smile:

PS: You should delete this API key anyway and create a new one! Also make sure your have payed credits on deepseek, otherwise it is also not working as far as I know. You need to spent a few dollars to your account, so its working.

Thanks for deleting the file! I’m definitely making rookie mistakes, that’s how you learn. I’ve reset the api keys. From now on, I’ll find a way for the api not to end up hard-coded as you advise.

Now, the “Todo List” app works very well in the preview with the new api key, but it’s impossible to chat with the ia to improve the app, I still get the error in the browser console “logger.ts:85 ERROR Chat Request failed
Error: An error occurred.”

The curious thing is that if I open a new conversation to create a new project, it works, so I guess it’s not a general deepkseek api key problem.

I think the problem is that the project is to big to handle by deepseek, cause of their rate limits.
We will provide a fix to the main branch soon, so show the exact errors coming from the provider/llm. then you will see what it is.

See the PR for more details:

Also a screenshot from a test of me their, where you can see such an error for ChatGPT. I think you will get something similar for your deepseek.

I think you’re right, but I can’t find any error message about this in bolt terminal…

Otherwise, I used a Google Gemini api and the AI converse and I can again ask it to continue developing the app. the first thing I did was to integrate a system allowing the API to be used securely and not hard (thanks again for that).

Now it’s working, thanks for the time you took to answer me so quickly, it’s super nice to have helped a non-developer :-).

I’m looking forward to testing the next version of Bolt.diy.

Regarding the API problem “fix: api-key manager cleanup and log error on llm call #1077

I realized it, I found this behavior strange. I’ll see if I’ll try to modify these files, taking care to save them or wait for a Bolt.diy update.

Thanks again for your help.

1 Like

your welcome. nice to hear you got your stuff working so far.
I am also not a developer, but Solution Architect / Technical Project Manager in this area (enterprise cms) :slight_smile:

Yes, it’s cool, I’m glad it’s working now. You’re doing great for a non-developer :slight_smile:

1 Like