#Discord channel response is returning Unexpected non-whitespace character after JSON message

1 messages · Page 1 of 1 (latest)

lilac topaz
#

After somehow exceeded my openai limit, I wanted to move to an openrouter model just to test a few things and ever since I switched to openrouter, the only response I get in my discord channel is 'Unexpected non-whitespace character after JSON at position 2 (line 1 column 3)'

In addition, the webchat UI responds in bubbles of what was performed?

frosty urchinBOT
#

Summary for joe's OpenRouter issue:

The error Unexpected non-whitespace character after JSON at position 2 (line 1 column 3) is caused by OpenRouter returning responses with a UTF-8 BOM (Byte Order Mark) character (\uFEFF). The pi-ai library doesn't strip this BOM before parsing JSON, causing the parse to fail.

This is a pi-ai bug, not a Clawdbot bug. The fix would be in @mariozechner/pi-ai around the JSON parsing logic.

Workarounds:

  1. Temporarily switch back to OpenAI until pi-ai is fixed
  2. Report this to pi-ai (Mario zechner) to add BOM stripping

To report to pi-ai:

This affects any Clawdbot user on openrouter until pi-ai is updated. 🦐