Invalid JSON Error (Bad control character) in HTTP Request when batching Sora2 Video Workflow

:bullseye: What is your goal?

I am building a multi-scenario workflow in Make to generate e-commerce short videos using Sora 2 (via KIE AI API).

Scenario 1: Analyzes product names/URLs to extract selling points into Google Sheets. (Works fine)

Scenario 2: Takes selling points from Sheets, uses Gemini to generate visual prompts, and writes them back to Sheets.

Scenario 3: Takes those visual prompts from Sheets and sends an HTTP POST request to KIE AI to generate the video.

Everything works perfectly for a single test run, but when I switch to batch processing, the 3rd scenario consistently fails with: InvalidConfigurationError: The provided JSON body content is not valid JSON. Bad control character in string literal in JSON at position 102 (or 115/185).

What have you tried?
I have followed KIE AI’s API documentation strictly for the Body Content. I suspect the issue lies in the data generated by Gemini in Scenario 2. It seems the output contains invisible line breaks or “bad control characters” that break the JSON structure in Scenario 3’s HTTP module.

My Question:
Is the error caused by the formatting of the Body Content in Scenario 2 (Gemini’s output) or Scenario 3 (HTTP request)?

How can I sanitize the text variables in Make to ensure they don’t break the JSON body during batch execution? (e.g., using replace() functions for newlines or quotes).

:thinking: What is the problem & what have you tried?

I am building a multi-scenario workflow in Make to generate e-commerce short videos using Sora 2 (via KIE AI API).

Scenario 1: Analyzes product names/URLs to extract selling points into Google Sheets. (Works fine)

Scenario 2: Takes selling points from Sheets, uses Gemini to generate visual prompts, and writes them back to Sheets.

Scenario 3: Takes those visual prompts from Sheets and sends an HTTP POST request to KIE AI to generate the video.

Everything works perfectly for a single test run, but when I switch to batch processing, the 3rd scenario consistently fails with: InvalidConfigurationError: The provided JSON body content is not valid JSON. Bad control character in string literal in JSON at position 102 (or 115/185).

What have you tried?
I have followed KIE AI’s API documentation strictly for the Body Content. I suspect the issue lies in the data generated by Gemini in Scenario 2. It seems the output contains invisible line breaks or “bad control characters” that break the JSON structure in Scenario 3’s HTTP module.

My Question:
Is the error caused by the formatting of the Body Content in Scenario 2 (Gemini’s output) or Scenario 3 (HTTP request)?

How can I sanitize the text variables in Make to ensure they don’t break the JSON body during batch execution? (e.g., using replace() functions for newlines or quotes).

:clipboard: Error messages or input/output bundles

InvalidConfigurationError
The provided JSON body content is not valid JSON.
Bad control character in string literal in JSON at position 102

Origin
Make

Automatic error handler
If you want to handle this error automatically, choose one of the following options. This will create a new error-handler route in your scenario. You can then expand the route in any way you like.

:camera_with_flash: Screenshots (scenario flow, module settings, errors)

Welcome to the Make community!

Please, avoid screenshots of output bundles. Furthermore, it has been cropped off, so we can’t see where the “Bad control character” is.

We’d love to help, however, we require more information that demonstrates the problem to help us reproduce the scenario and any issues and errors.

To allow others to assist you, please provide the following:

1. All Relevant Screenshots

We need to see what you’re working with to give you the best advice. Screenshots are important because Make is a visual editor — a picture provides us with more context.

It would help us identify the issue by having screenshots of:

  • the full scenario, and the zoomed in parts of the scenario that you are referring to (if your scenario is huge),
  • a full scenario run/execution from the history (showing output “speech” bubbles),
  • relevant module fields (showing how you’ve used any built-in functions, and how you’ve mapped the variables),
  • relevant filters between modules (showing which operators and any built-in functions you’ve used, and how you’ve mapped the variables),
  • relevant module input/output bubbles,
  • if applicable, any error messages,
  • and if applicable, any external services (spreadsheet headers/ sample data/ regex101.com/ etc. to show the item/ record exists, and is set up correctly).
Need help❓View instructions ◀

We would appreciate it if you could directly upload screenshots here instead of linking to them outside of this forum. This allows us to zoom in on the image when clicked, and also having improved privacy from third-party sources.

Taking Screenshots

  • Microsoft Windows: Take screenshots using the “Windows Snipping Tool”, by pressing either PrtSc or WinShiftS keys on your keyboard.
  • MacOS: Take screenshots by pressing CommandShift4 keys on your keyboard.

Uploading Attachments

  • Drag image files directly into the rich-text editor, or
  • Click on the upload button in the editor toolbar to select files:

2. Scenario Blueprint

Providing your scenario will allow others to quickly recreate and see how you have set up the mappings in each module, and also allows us take screenshots or provide module exports of any solutions we have for you in return. This would benefit you in implementing our suggestions as you can view screenshots of the changes or paste corrected modules back into your scenario.

Need help❓View instructions ◀

A. Export Blueprint

In the scenario editor, click the three dots at the top-right, then select “Export blueprint”.

  • You can upload files and images to this forum by clicking on the upload button:

    Uploading an attachment here will look like this:
    blueprint.json (12.3 KB)

B. Create Public Share Link

In the scenario editor, click on the Share button:

Read more about the scenario sharing feature in the Help Centre.

3. Properly-formatted Output Bundles from a Scenario Run

Please provide the input/output bundles of each of the relevant modules by running the scenario, or get the bundles from a previous run from the Scenario “History” tab.

Providing the bundles from a scenario run will allow others to replicate what is going on, especially if there are complex data structures (nested arrays and collections) and external services. This helps mapping the correct raw variable names from collections (instead of the label/display name).

Need help❓View instructions ◀

Click on the white speech bubbles on the top-right of each module and select “Download output (or input) bundles”.

A. Upload a Text File

Save each bundle contents in a plain text editor as a moduleNumber-output.txt file. Open the file to check if it has not added additional formatting or encoded the plain text.

  • You can upload files and images to this forum by clicking on the upload button:

    Uploading an attachment here will look like this:
    module1-input.txt (1.2 KB)
    module1-output.txt (3.4 KB)

B. Insert a Formatted Code Block

If you are unable to upload files on this forum, alternatively you can paste the bundles AND format them correctly.

:warning: Formatting IS Important! :warning:

Here are some ways to provide text content in a way that it won’t be modified by the forum.

  • Method 1: Type code fence manually —
    Manually type three backticks ``` in a separate line before and after the content, like this,

    ```
    text goes here
    ```
    
  • Method 2: Highlight the pasted content, then click the preformatted text/code button —

  • Method 3: Upload your file elsewhere and share the public link —
    This method is only advised for large files exceeding the forum upload limit.

Sharing these details will make it easier for others to assist you, so that you can get better answers, faster.

Hope this helps! If you are still having trouble, please provide more details.

— @samliew
P.S.: investing some effort into the tutorials in the Make Academy will save you lots of time and frustration using Make!

Hi, thanks for your reply! Here are the screenshots of my configurations for Scenario 2 and Scenario 3:

1. Scenario 2 (Gemini Output):

  • This scenario generates the visual prompt and script into Google Sheets.

  • As you can see in the output bundle, Gemini often includes line breaks (newlines) and sometimes markdown code blocks like ```json.

2. Scenario 3 (HTTP POST Request to KIE AI):

  • Error: InvalidConfigurationError: Bad control character in string literal.

  • Module Setup: I am mapping the cell value from Google Sheets directly into the prompt field of the JSON body.

  • The Issue: When the text contains newlines or double quotes from the previous scenario, it seems to break the JSON structure in this HTTP module, causing the “position 102/115/185” errors.

Could you please advise on the best way to sanitize this string within the HTTP body to ensure it’s valid JSON for batch processing?

script0111.blueprint.json (56.3 KB)

video0112.blueprint.json (46.3 KB)

Hey there,

that looks like an output of a chatgpt module where you told it to give you a JSON as a response INSTEAD of toggling the option and forcing a JSON response.

So that’s not a JSON you are parsing, that’s just an AI hallucination of a JSON.

Have you seen these previous discussions?

Your question may already have answers here:

You can search this forum for existing answers and the documentation in the Help Centre to get to a solution faster.

Still require assistance?

If the previous/related discussions are not similar to your question, please reply providing additional details to demonstrate the difference(s) between your question and the ones above.

If you require help understanding or implementing workarounds/solutions in the related discussions, please reply with more details of what you have tried, including screenshots.

— @samliew