[GH-ISSUE #15987] bge-m3 embedding API 500 error with Chinese text + single quote apostrophe on Windows #87866

Open
opened 2026-05-10 06:28:13 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @VisionYz on GitHub (May 6, 2026).
Original GitHub issue: https://github.com/ollama/ollama/issues/15987

What is the issue?

When using the bge-m3 embedding model via Ollama local API on Windows,
the API returns HTTP 500 error if input text contains Chinese characters + English single quote '.

Reproduce with PowerShell

Success case (without single quote)

$body = @{
model = "bge-m3"
input = @(
"方正科技信息有限公司云计算 is a technology company, the customers company, involved in cloud computing"
)
} | ConvertTo-Json -Depth 10

Invoke-RestMethod -Uri "http://127.0.0.1:11434/v1/embeddings" -Method Post -ContentType "application/json" -Body $body

Failed case (with single quote)

$body = @{
model = "bge-m3"
input = @(
"方正科技信息有限公司云计算 is a technology company, the customer's company, involved in cloud computing"
)
} | ConvertTo-Json -Depth 10

Invoke-RestMethod -Uri "http://127.0.0.1:11434/v1/embeddings" -Method Post -ContentType "application/json" -Body $body

Error Message

{"error":{"message":"failed to encode response: json: unsupported value: NaN","type":"api_error","param":null,"code":null}}

Environment

  • Ollama version: 0.21.0
  • OS: Windows 11
  • Model: bge-m3
  • Client: Windows PowerShell

Relevant log output


OS

No response

GPU

No response

CPU

No response

Ollama version

No response

Originally created by @VisionYz on GitHub (May 6, 2026). Original GitHub issue: https://github.com/ollama/ollama/issues/15987 ### What is the issue? When using the bge-m3 embedding model via Ollama local API on Windows, the API returns HTTP 500 error if input text contains **Chinese characters + English single quote '**. ### Reproduce with PowerShell #### Success case (without single quote) $body = @{ model = "bge-m3" input = @( "方正科技信息有限公司云计算 is a technology company, the customers company, involved in cloud computing" ) } | ConvertTo-Json -Depth 10 Invoke-RestMethod -Uri "http://127.0.0.1:11434/v1/embeddings" -Method Post -ContentType "application/json" -Body $body #### Failed case (with single quote) $body = @{ model = "bge-m3" input = @( "方正科技信息有限公司云计算 is a technology company, the customer's company, involved in cloud computing" ) } | ConvertTo-Json -Depth 10 Invoke-RestMethod -Uri "http://127.0.0.1:11434/v1/embeddings" -Method Post -ContentType "application/json" -Body $body ### Error Message {"error":{"message":"failed to encode response: json: unsupported value: NaN","type":"api_error","param":null,"code":null}} ### Environment - Ollama version: 0.21.0 - OS: Windows 11 - Model: bge-m3 - Client: Windows PowerShell ### Relevant log output ```shell ``` ### OS _No response_ ### GPU _No response_ ### CPU _No response_ ### Ollama version _No response_
GiteaMirror added the bug label 2026-05-10 06:28:13 -05:00
Author
Owner

@solicomo commented on GitHub (May 7, 2026):

Has nothing to do with Chinese character.
Can be reproduced without it.

<!-- gh-comment-id:4401364943 --> @solicomo commented on GitHub (May 7, 2026): Has nothing to do with Chinese character. Can be reproduced without it.
Author
Owner

@VisionYz commented on GitHub (May 8, 2026):

Has nothing to do with Chinese character. Can be reproduced without it.

You're right. The actual trigger is the English single quote '.
Besides that, I also encountered another scenario that causes exactly the same error. For example, texts like this:

$inputTexts = @(
"合联电子传媒有限公司信息技术:一家位于中国丽娟县的信息技术传媒公司,是客户OH388的所属企业",
"婷婷县:中国的一个县,客户JF511所在地"
)

$body = @{
model = "bge-m3"
input = $inputTexts
} | ConvertTo-Json -Depth 10

Invoke-RestMethod -Uri "http://127.0.0.1:11434/v1/embeddings" -Method Post -ContentType "application/json" -Body $body

This issue occurs stably in the project, but I cannot reproduce it manually.
It seems related to batch processing and the bge-m3 model itself, and it only occurs when using Ollama's OpenAI-compatible API endpoint.
I couldn’t identify the root cause, so I resolved it by switching to another embedding model.

<!-- gh-comment-id:4403077660 --> @VisionYz commented on GitHub (May 8, 2026): > Has nothing to do with Chinese character. Can be reproduced without it. You're right. The actual trigger is the English single quote '. Besides that, I also encountered another scenario that causes exactly the same error. For example, texts like this: $inputTexts = @( "合联电子传媒有限公司信息技术:一家位于中国丽娟县的信息技术传媒公司,是客户OH388的所属企业", "婷婷县:中国的一个县,客户JF511所在地" ) $body = @{ model = "bge-m3" input = $inputTexts } | ConvertTo-Json -Depth 10 Invoke-RestMethod -Uri "http://127.0.0.1:11434/v1/embeddings" -Method Post -ContentType "application/json" -Body $body This issue occurs stably in the project, but I cannot reproduce it manually. It seems related to batch processing and the bge-m3 model itself, and it only occurs when using Ollama's OpenAI-compatible API endpoint. I couldn’t identify the root cause, so I resolved it by switching to another embedding model.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#87866