I created a workflow with the API, when i try to open in in the dashboard there is an error: Something Went Wrong!
Cannot read properties of undefined (reading 'length')
workflow:
id:"dfb73a06-11ed-40c8-85a9-5d918f56d481"
orgId:"0c4a538b-7cef-44a5-a1a7-b8533e8f45bc"
v
Vapi Support Bot
04/07/2025, 2:48 PM
Hi there! 👋 Sorry to hear you're having trouble opening your workflow in the dashboard.
I wasn't able to find the exact cause of the 'length' property error for your specific workflow ID. However, I can help with several troubleshooting steps for this type of error when opening API-created workflows in the dashboard.
According to the [troubleshooting information](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1328923059905630238) I found, here are some steps you can try:
## General Troubleshooting Steps:
1. Refresh your dashboard page or try clearing your browser cache
2. Try incognito mode or a different browser
3. Review browser console and network logs to get more details about the error
## Potential Causes:
The error "Cannot read properties of undefined (reading 'length')" typically occurs when the code is trying to access a property of an object that doesn't exist. In your case, this might be due to:
1. **Workflow Validation Issues**: According to [Vapi documentation](https://docs.vapi.ai/workflows), "A workflow cannot be saved until every node is connected and configured." When creating via API, make sure all nodes are properly connected.
2. **Data Type Issues**: The error could be related to [incorrect data types](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1332319207936757815) being used in the API request that created the workflow.
3. **Analysis Extraction Object Properties**: There might be [inconsistencies in the analysis extraction object properties](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1339019564838686740) if you created an object with required properties and then removed or renamed them.
4. **Beta Feature Issues**: It's worth noting that [workflows are in beta](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1341786285379162123) and therefore potentially buggy, especially with conditional nodes.
I was able to figure out what's causing the problem, in the workflow POST request (to create the workflow), I had the following definition (:
const workflowDefinition = {
name: 'test',
nodes: [
{
type: 'start',
name: 'start',
metadata: {
position: { x: 120, y: 100 },
},
},
...]
edges: [ ... ]
model: {
model: 'gemini-2.0-flash',
provider: 'google',
temperature: 0.7,
maxTokens: 4000,
},
}
If I don't send the model object, the workflow works in the dashboard. For now it's okay for me, but may you could check if this behavior is intended?
nizmo
04/07/2025, 3:53 PM
Okay, the Problem is that the messages array wasn't defined inside the model object.
You should definitely add a API validation check if the messages are set or not 🙂
(Or a failcheck in the frontend)
if the model object is defined like this:
model: {
model: 'gemini-2.0-flash',
messages: [
{
role: 'system',
content:
'Du bist Hans, ein Mitarbeiter von Bestellbeimir',
},
],
provider: 'google',
temperature: 0.7,
maxTokens: 4000,
},
it works!
s
Sahil
04/07/2025, 10:54 PM
Hey, nizmo, you found it right. This is the intended schema or structure for the assistant. Let me know if you require further help.