Code Tool Error
# support
e
Hi, I am trying to create a Code Tool and my code under the code snippet is correct and I can successfully test it, but when I added the parameters a warning sign appears and doesn’t go away although everything looks correct and I cannot save my changes. Does anybody know what that is about and can help? I think it is a general bug. Thank you in advance! https://cdn.discordapp.com/attachments/1447982948547690658/1447982949055205511/IMG_8267.jpg?ex=6940daf5&is=693f8975&hm=dd51dc32b7e38436cb20d3d202fb2e4eb1f04b53dbac3760d5b11d10d7e7d69b& https://cdn.discordapp.com/attachments/1447982948547690658/1447982949533225282/IMG_8266.jpg?ex=6940daf5&is=693f8975&hm=8bd48710d64ffa62f32d82cb66fc89f2805273495dd82494ab08dec3be473af1&
v
It looks like the error is due to the parameter schema needing to be an object with the correct structure. Try using this format for your parameters:
Copy code
json
{
  "type": "object",
  "properties": {
    "specialty_id": { "type": "number", "description": "Specialty ID" },
    "insurer_id": { "type": "number" },
    "payment_method_id": { "type": "number" },
    "name": { "type": "string" },
    "works_with_adults": { "type": "boolean" },
    "works_with_children": { "type": "boolean" }
  },
  "required": ["specialty_id"]
}
Make sure your schema matches this structure—this should resolve the "expected 'object'" validation error. For more details, see the [custom tools troubleshooting guide](https://docs.vapi.ai/tools/custom-tools-troubleshooting). Source: - [Custom tools troubleshooting](https://docs.vapi.ai/tools/custom-tools-troubleshooting)
e
I am doing this via the dashboard, not programatically, so I do not have control over the schema, I tried adding an object as a parameter under section Parameters but it led to the same error, is this a bug since it doesn’t happen if I am building a function tool and adding the parameters the same way? @User
@Vapi Support Bot the error is : Form has validation errors: Invalid literal value, expected "object" Click the warning icon to run full validation. Kind of frustrating as there are allot of small issues which sometimes are not making any sense. Do you guys have any live events to get help?
v
Try this: In the dashboard, ensure each parameter is added individually (not as a nested object), and double-check that all parameter types match the expected JSON schema (e.g.,
"type": "string"
,
"type": "number"
). If the error persists, it may be a dashboard bug—report it via [Vapi Support](https://docs.vapi.ai/support) or join the [Vapi Discord](https://discord.com/invite/pUFNcf2WmH) for real-time help. Example parameter entry: - Name:
phone_number
- Type:
string
- Required: checked If you still see the error, please share your exact parameter setup with support for further troubleshooting. Sources: - [Custom tools troubleshooting](https://docs.vapi.ai/tools/custom-tools-troubleshooting) - [Vapi Support](https://docs.vapi.ai/support)
n
is there only a bot replying any real human here?
c
Hi eliterzieva, It seems you're encountering a validation issue with your Code Tool's parameter setup. To resolve the "expected 'object'" error, make sure your parameter schema is correctly formatted as an object. Here's a sample JSON structure you can follow:
Copy code
json
{
  "type": "object",
  "properties": {
    "specialty_id": { "type": "number", "description": "Specialty ID" },
    "insurer_id": { "type": "number" },
    "payment_method_id": { "type": "number" },
    "name": { "type": "string" },
    "works_with_adults": { "type": "boolean" },
    "works_with_children": { "type": "boolean" }
  },
  "required": ["specialty_id"]
}
Make sure to double-check that each parameter is added individually with the correct type, and the overall schema format matches the above structure. If you continue to experience issues, it may be related to a dashboard bug. You can report such bugs via [Vapi Support](https://docs.vapi.ai/support) or join the [Vapi Discord](https://discord.com/invite/pUFNcf2WmH) for additional assistance.
e
Again, I am doing this via the dashboard and I have ZERO control over the schema. Can you please test this in the dashboard and see what is happening or present a viable solution?
c
I thought I am going crazy, I am experiencing the same error. Form has validation errors: Invalid literal value, expected "object" Click the warning icon to run full validation
n
No body helps though
m
their dashboard is broken, only way to build a code tool currently is via API
Honestly, I can't even get the API to work, it is still throwing parameter errors. I suspect the entire code tool implementation is broken - they have two conflicting versions of the parameter schema that are invalidating each other - the create tool endpoint expects the Code Tool shape that uses "function", not flat fields, but the analyzer is looking for parameters somewhere else, probably at top level
I just spent an hour throwing every possible shape at the API, it's very annoying that they shipped a broken tool like this
c
We are looking into it. Will provide an update soon
m
any news?
2 Views