Skip to content

Commit 53aaea7

Browse files
fpagnySamyOubouaziznerda-codes
authored
feat(genapi): add json body invalid troubleshooting (#4910)
* feat(genapi): add json body invalid troubleshooting * Apply suggestions from code review Co-authored-by: Néda <[email protected]> --------- Co-authored-by: SamyOubouaziz <[email protected]> Co-authored-by: Néda <[email protected]>
1 parent 077c892 commit 53aaea7

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

pages/generative-apis/troubleshooting/fixing-common-issues.mdx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@ Below are common issues that you may encounter when using Generative APIs, their
2626
- `15k` tokens context window on `H100` Instances
2727
- `128k` tokens context window on `H100-2` Instances
2828

29+
## 400: Bad Request - Invalid JSON body
30+
31+
### Cause
32+
- You provided a JSON body that does not follow the [standard JSON structure](https://datatracker.ietf.org/doc/html/rfc8259), therefore your request cannot be analyzed.
33+
34+
### Solution
35+
- Verify the JSON body you send is valid:
36+
- You can store your content in a file with the `.json` extension (eg. named `file.json`), and open it with an IDE such as VSCode or Zed. Syntax errors should display if there are any.
37+
- You can copy your content in a JSON formatter tool or linter available online, that will identify errors.
38+
- Usually, most common errors include:
39+
- Missing or unecessary quotes `"`, `'` or commas `,` on properties name and string values.
40+
- Special characters that are not escaped, such as line break `\n` or backslash `\\`
41+
2942
## 403: Forbidden - Insufficient permissions to access the resource
3043

3144
### Cause
@@ -234,4 +247,4 @@ This snippet will output the model response, which is `4`.
234247
### Debugging silent errors
235248
- For cases where no explicit error is returned:
236249
- Verify all fields in the API request are correctly named and formatted.
237-
- Test the request with smaller and simpler inputs to isolate potential issues.
250+
- Test the request with smaller and simpler inputs to isolate potential issues.

0 commit comments

Comments
 (0)