Skip to content

Commit 2ec4d36

Browse files
authored
feat(genapi): add json body invalid troubleshooting
1 parent 84ff47e commit 2ec4d36

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 [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 `.json` extension (eg. named `file.json`), and open it with an IDE such as VSCode or Zed. Syntax errors should display if there are present.
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)