Troubleshooting the Embedded AI Assistant

If the embedded AI assistant isn’t doing what you expect, for example it thinks for a long time and then gives no answer, you can turn on debug mode. In debug mode, the assistant writes a line in your browser’s console for every request it sends to the AI, and for every tool it uses. This shows you, step by step, what happened. You can also copy these lines into a bug report.

Debug mode only affects your own browser. It doesn’t change anything for anyone else using your Formulize system.

Turn on debug mode

  1. Open your browser’s console. Go to any page of your Formulize site, then:

    • Chrome or Edge: press Ctrl+Shift+J (Windows/Linux) or Cmd+Option+J (Mac)
    • Firefox: press Ctrl+Shift+K (Windows/Linux) or Cmd+Option+K (Mac)
    • Safari: first turn on Show features for web developers in Settings > Advanced, then press Cmd+Option+C
  2. Type or paste this line into the console, and press Enter:

    localStorage.setItem('formulize_ai_debug', '1')
    

    The first time you paste something into the console, your browser may warn you about it and block the paste. If that happens, follow the instructions in the warning (in Chrome, you type allow pasting and press Enter), then paste the line again.

  3. Reload the page. Debug mode starts when the assistant loads. If you use the assistant in the slide-out panel, reload the page and then open the panel again.

Leave the console open, and use the assistant as normal.

What you’ll see

Each time the assistant sends a request to the AI, a line like this appears in the console:

[Formulize AI] claude round 1 {requestChars: 48213, elapsedMs: 71354, status: 200, stop_reason: 'max_tokens', ...}

Click the line to expand it. These are the parts to look at:

  • round - one message from you can take several rounds. The AI asks for a tool, gets the result, and then continues. The rounds are numbered from 1 for each message you send.
  • elapsedMs - how long the AI took to answer, in milliseconds. 60000 is one minute.
  • status - 200 means the request worked. A status of 502, 503 or 504 means your web server stopped waiting for the AI before it answered.
  • stop_reason (Claude), finish_reason (OpenAI and Ollama), or finishReason (Gemini) - why the AI stopped:
    • end_turn, stop or STOP - it finished normally
    • tool_use or tool_calls - it wants to use a tool, and another round will follow
    • max_tokens, length or MAX_TOKENS - its answer reached the maximum length for a single response and was cut off. On a big job, this can happen while the AI is still planning, before it has done anything. When the AI is cut off before it finishes what it was doing, the assistant tells it to work in smaller steps, and it tries again. If it keeps getting cut off without getting anything done, the assistant stops and asks you to ask for less at once.
  • usage - how many tokens the request used. This is the amount your AI provider bills you for.
  • error - the error message, if there was one.

Each time the AI uses one of the Formulize tools, a line like this appears:

[Formulize AI] tool create_entries {argsChars: 5120, resultChars: 812, elapsedMs: 2350}

It shows the name of the tool, the size of the request the AI made and of the result it got back, how long the tool took, and any error.

Send the log with a bug report

To report a bug, copy the console lines after you reproduce the problem, and include them in your report. In Chrome and Edge, right-click in the console and choose Save as… to save everything as a file. In any browser, you can also select the lines with your mouse and copy them.

Expand the lines first, so the details are included. The log records sizes, timings and error messages, not the content of your conversation, and it never contains your API key. Error messages can mention the names of forms or elements, so read through the log before you share it.

Test with a short response limit

To see how the assistant copes when an answer is too long, without asking for something huge, you can make the maximum response length much shorter. Debug mode has to be on for this to work. In the console, enter:

localStorage.setItem('formulize_ai_max_tokens', '700')

Then reload the page. Every answer is now limited to about 700 tokens, which is roughly 500 words. Ask the assistant to create ten entries in a test form. You’ll usually see one or two rounds with max_tokens (or length, or MAX_TOKENS), followed by the AI making several smaller tool requests, one per round.

Different AI models need different limits for this. If all ten entries arrive in one request, lower the number. If the assistant stops and tells you it kept reaching the length limit, even a small step didn’t fit, so raise the number.

Remove the limit when you’re done:

localStorage.removeItem('formulize_ai_max_tokens')

Turn off debug mode

In the console, enter this line, then reload the page:

localStorage.removeItem('formulize_ai_debug')