Issue evidence · AI API · ollama/ollama

bge-m3 returns HTTP 500 with "json: unsupported value: NaN" when embedding certain markdown files

GitHub issue: https://github.com/ollama/ollama/issues/15582

Reproduced

bge-m3 produces a NaN in the embedding for a specific markdown file, and Ollama fails to encode the response.

What Badgr ran

Ran the deterministic reproducer posted in the issue thread (five sentences plus an Arabic string) against Ollama 0.23.0 and 0.40.3 on an RTX 4090 through Badgr, calling /api/embeddings with default options and with num_gpu: 0. The reporter's own markdown file is not in the issue.

What came back

  • Ollama 0.23.0: 1 of 6 GPU requests returned HTTP 500 "failed to encode response: json: unsupported value: NaN" (the first sentence); CPU with num_gpu 0 returned 200 for all 6.
  • Ollama 0.40.3: 6 of 6 returned 200 on GPU and on CPU.

Only 1 of 6 failed here, against 5 of 5 on the commenter's RTX 4070 SUPER, and it was the first request after model load, so the trigger may depend on GPU and timing. Workaround from the thread: a model alias with num_gpu 0. The original markdown file was not tested.

Checked 2026-10-15 in Badgr’s local development environment.

← All issue evidence