[GH-ISSUE #12422] failed to load model vocabulary required for format #34011

Closed
opened 2026-04-22 17:14:08 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @nicho2 on GitHub (Sep 26, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/12422

What is the issue?

Hello ,
I want used oss-gpt-20b to structure a part of a document to a json format

but I obtain an error from ollama : failed to load model vocabulary required for format

the http request is (see the file):

POST /api/chat HTTP/1.1
Host: 10.2.142.77:11434
User-Agent: python-requests/2.32.5
Accept-Encoding: gzip, deflate
Accept: /
Connection: keep-alive
Content-Type: application/json
Content-Length: 18753

{
	"model": "gpt-oss:20b",
	"stream": true,
	"format": {
		"title": "Extraction facture électricité – Contrat & Bilan GES",
		"description": "Schéma de données cible pour l’extraction automatisée (via LLM) d’informations contractuelles et du bilan GES (CO₂) à partir d’une facture. Les nombres doivent être normalisés : séparateurs de milliers supprimés, virgule décimale convertie en point.",
		"type": "object",
		"required": [
			"informations_contractuelles",
			"bilan_ges"
		],
		"properties": {
			..........}

	},
	"options": {
		"temperature": 0.2
	},
	"think": true,
	"messages": [
		{
			"role": "system",
			"content": "Extraits les données\n\n{......... here content of the document ..............."
		},
		{
			"role": "user",
			"content": "go\n"
		}
	]
}

HTTP/1.1 200 OK
Content-Type: application/x-ndjson
Date: Thu, 25 Sep 2025 14:10:38 GMT
Transfer-Encoding: chunked

{"error":"failed to load model vocabulary required for format\n"}

http_request.txt

Relevant log output

time=2025-09-26T05:51:56.798Z level=TRACE source=bytepairencoding.go:280 msg=decoded string=<|reserved_201083|> from=[201083]
time=2025-09-26T05:51:56.798Z level=TRACE source=bytepairencoding.go:280 msg=decoded string=<|reserved_201084|> from=[201084]
time=2025-09-26T05:51:56.798Z level=TRACE source=bytepairencoding.go:280 msg=decoded string=<|reserved_201085|> from=[201085]
time=2025-09-26T05:51:56.798Z level=TRACE source=bytepairencoding.go:280 msg=decoded string=<|reserved_201086|> from=[201086]
time=2025-09-26T05:51:56.798Z level=TRACE source=bytepairencoding.go:280 msg=decoded string=<|reserved_201087|> from=[201087]
time=2025-09-26T05:51:56.798Z level=TRACE source=bytepairencoding.go:280 msg=decoded string=<|begin_of_text|> from=[201088]
time=2025-09-26T05:51:56.798Z level=TRACE source=bytepairencoding.go:280 msg=decoded string=<|end_of_text|> from=[201089]


parse: error parsing grammar: unknown escape at \d"{5,5}) "\"" space

informations-contractuelles-acheminement-segment-kv ::= "\"segment\"" space ":" space informations-contractuelles-acheminement-segment

bilan-ges-emissions-totales-tco2e-kv ::= "\"emissions_totales_tco2e\"" space ":" space number

adresse ::= "{" space adresse-ligne1-kv "," space adresse-code-postal-kv "," space adresse-ville-kv ( "," space ( adresse-ligne2-kv adresse-ligne2-rest | adresse-pays-kv adresse-pays-rest | adresse-brut-kv ) )? "}" space

informations-contractuelles-adresse-livraison ::= adresse

informations-contractuelles-date-echeance-contractuelle-kv ::= "\"date_echeance_contractuelle\"" space ":" space informations-contractuelles-date-echeance-contractuelle

adresse-code-postal-kv ::= "\"code_postal\"" space ":" space adresse-code-postal

informations-contractuelles-type-compteur-kv ::= "\"type_compteur\"" space ":" space string

date-string ::= "\"" date "\"" space
...................


root ::= "{" space informations-contractuelles-kv "," space bilan-ges-kv ( "," space ( source-kv ) )? "}" space

bilan-ges-mix-energetique-renouvelables-solaire-pct-kv ::= "\"solaire_pct\"" space ":" space bilan-ges-mix-energetique-renouvelables-solaire-pct

bilan-ges-mix-energetique-renouvelables-biomasse-pct ::= number

llama_grammar_init_impl: failed to parse grammar

grammar_init: failed to initialize grammar

time=2025-09-26T05:51:56.902Z level=INFO source=server.go:1469 msg="llm predict error: failed to load model vocabulary required for format"

[GIN] 2025/09/26 - 05:51:56 | 200 |  5.812100575s |      172.21.0.1 | POST     "/api/chat"

OS

Docker

GPU

Nvidia

CPU

Intel

Ollama version

0.12.2

Originally created by @nicho2 on GitHub (Sep 26, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/12422 ### What is the issue? Hello , I want used oss-gpt-20b to structure a part of a document to a json format but I obtain an error from ollama : failed to load model vocabulary required for format the http request is (see the file): POST /api/chat HTTP/1.1 Host: 10.2.142.77:11434 User-Agent: python-requests/2.32.5 Accept-Encoding: gzip, deflate Accept: */* Connection: keep-alive Content-Type: application/json Content-Length: 18753 { "model": "gpt-oss:20b", "stream": true, "format": { "title": "Extraction facture électricité – Contrat & Bilan GES", "description": "Schéma de données cible pour l’extraction automatisée (via LLM) d’informations contractuelles et du bilan GES (CO₂) à partir d’une facture. Les nombres doivent être normalisés : séparateurs de milliers supprimés, virgule décimale convertie en point.", "type": "object", "required": [ "informations_contractuelles", "bilan_ges" ], "properties": { ..........} }, "options": { "temperature": 0.2 }, "think": true, "messages": [ { "role": "system", "content": "Extraits les données\n\n{......... here content of the document ..............." }, { "role": "user", "content": "go\n" } ] } HTTP/1.1 200 OK Content-Type: application/x-ndjson Date: Thu, 25 Sep 2025 14:10:38 GMT Transfer-Encoding: chunked **{"error":"failed to load model vocabulary required for format\n"}** [http_request.txt](https://github.com/user-attachments/files/22554249/http_request.txt) ### Relevant log output ```shell time=2025-09-26T05:51:56.798Z level=TRACE source=bytepairencoding.go:280 msg=decoded string=<|reserved_201083|> from=[201083] time=2025-09-26T05:51:56.798Z level=TRACE source=bytepairencoding.go:280 msg=decoded string=<|reserved_201084|> from=[201084] time=2025-09-26T05:51:56.798Z level=TRACE source=bytepairencoding.go:280 msg=decoded string=<|reserved_201085|> from=[201085] time=2025-09-26T05:51:56.798Z level=TRACE source=bytepairencoding.go:280 msg=decoded string=<|reserved_201086|> from=[201086] time=2025-09-26T05:51:56.798Z level=TRACE source=bytepairencoding.go:280 msg=decoded string=<|reserved_201087|> from=[201087] time=2025-09-26T05:51:56.798Z level=TRACE source=bytepairencoding.go:280 msg=decoded string=<|begin_of_text|> from=[201088] time=2025-09-26T05:51:56.798Z level=TRACE source=bytepairencoding.go:280 msg=decoded string=<|end_of_text|> from=[201089] parse: error parsing grammar: unknown escape at \d"{5,5}) "\"" space informations-contractuelles-acheminement-segment-kv ::= "\"segment\"" space ":" space informations-contractuelles-acheminement-segment bilan-ges-emissions-totales-tco2e-kv ::= "\"emissions_totales_tco2e\"" space ":" space number adresse ::= "{" space adresse-ligne1-kv "," space adresse-code-postal-kv "," space adresse-ville-kv ( "," space ( adresse-ligne2-kv adresse-ligne2-rest | adresse-pays-kv adresse-pays-rest | adresse-brut-kv ) )? "}" space informations-contractuelles-adresse-livraison ::= adresse informations-contractuelles-date-echeance-contractuelle-kv ::= "\"date_echeance_contractuelle\"" space ":" space informations-contractuelles-date-echeance-contractuelle adresse-code-postal-kv ::= "\"code_postal\"" space ":" space adresse-code-postal informations-contractuelles-type-compteur-kv ::= "\"type_compteur\"" space ":" space string date-string ::= "\"" date "\"" space ................... root ::= "{" space informations-contractuelles-kv "," space bilan-ges-kv ( "," space ( source-kv ) )? "}" space bilan-ges-mix-energetique-renouvelables-solaire-pct-kv ::= "\"solaire_pct\"" space ":" space bilan-ges-mix-energetique-renouvelables-solaire-pct bilan-ges-mix-energetique-renouvelables-biomasse-pct ::= number llama_grammar_init_impl: failed to parse grammar grammar_init: failed to initialize grammar time=2025-09-26T05:51:56.902Z level=INFO source=server.go:1469 msg="llm predict error: failed to load model vocabulary required for format" [GIN] 2025/09/26 - 05:51:56 | 200 | 5.812100575s | 172.21.0.1 | POST "/api/chat" ``` ### OS Docker ### GPU Nvidia ### CPU Intel ### Ollama version 0.12.2
GiteaMirror added the needs more infobug labels 2026-04-22 17:14:08 -05:00
Author
Owner

@nicho2 commented on GitHub (Sep 26, 2025):

i have the same thing with mistral-small3.2

<!-- gh-comment-id:3337001852 --> @nicho2 commented on GitHub (Sep 26, 2025): i have the same thing with mistral-small3.2
Author
Owner

@rick-github commented on GitHub (Sep 26, 2025):

The parser doesn't support \d. Use [0-9] instead.

--- http_request.txt.orig	2025-09-26 13:39:54.309790994 +0200
+++ http_request.txt	2025-09-26 13:39:46.133826263 +0200
@@ -77,7 +77,7 @@
 					"pdl_prm": {
 						"type": "string",
 						"description": "Identifiant Point de Livraison / PRM (France). Normaliser en 14 chiffres sans espace.",
-						"pattern": "^\\d{14}$",
+						"pattern": "^[0-9]{14}$",
 						"examples": [
 							"30004568897531"
 						]
@@ -242,7 +242,7 @@
 					"code_postal": {
 						"type": "string",
 						"description": "Code postal (format FR à 5 chiffres si applicable).",
-						"pattern": "^\\d{5}$"
+						"pattern": "^[0-9]{5}$"
 					},
 					"ville": {
 						"type": "string",
<!-- gh-comment-id:3338283720 --> @rick-github commented on GitHub (Sep 26, 2025): The parser doesn't support `\d`. Use `[0-9]` instead. ```diff --- http_request.txt.orig 2025-09-26 13:39:54.309790994 +0200 +++ http_request.txt 2025-09-26 13:39:46.133826263 +0200 @@ -77,7 +77,7 @@ "pdl_prm": { "type": "string", "description": "Identifiant Point de Livraison / PRM (France). Normaliser en 14 chiffres sans espace.", - "pattern": "^\\d{14}$", + "pattern": "^[0-9]{14}$", "examples": [ "30004568897531" ] @@ -242,7 +242,7 @@ "code_postal": { "type": "string", "description": "Code postal (format FR à 5 chiffres si applicable).", - "pattern": "^\\d{5}$" + "pattern": "^[0-9]{5}$" }, "ville": { "type": "string", ```
Author
Owner

@nicho2 commented on GitHub (Sep 29, 2025):

Hello,
ok, now i have no error
but no stream and no content too

HTTP/1.1 200 OK
Content-Type: application/x-ndjson
Date: Mon, 29 Sep 2025 09:04:15 GMT
Transfer-Encoding: chunked

{
	"model": "gpt-oss:20b",
	"created_at": "2025-09-29T09:04:15.22508816Z",
	"message": {
		"role": "assistant",
		"content": ""
	},
	"done": true,
	"done_reason": "stop",
	"total_duration": 12571188782,
	"load_duration": 148595673,
	"prompt_eval_count": 3120,
	"prompt_eval_duration": 39698926,
	"eval_count": 387,
	"eval_duration": 11321620519
}

I tried with mistral-small3.2 and it's OK

HTTP/1.1 200 OK
Content-Type: application/x-ndjson
Date: Mon, 29 Sep 2025 09:13:02 GMT
Transfer-Encoding: chunked

8c
{"model":"mistral-small3.2:latest","created_at":"2025-09-29T09:13:02.467320809Z","message":{"role":"assistant","content":"{"},"done":false}

8d
{"model":"mistral-small3.2:latest","created_at":"2025-09-29T09:13:02.50465758Z","message":{"role":"assistant","content":" \""},"done":false}

8f
{"model":"mistral-small3.2:latest","created_at":"2025-09-29T09:13:02.554222167Z","message":{"role":"assistant","content":"info"},"done":false}

8c
{"model":"mistral-small3.2:latest","created_at":"2025-09-29T09:13:02.607595026Z","message":{"role":"assistant","content":"r"},"done":false}

......

13f
{
	"model": "mistral-small3.2:latest",
	"created_at": "2025-09-29T09:13:13.496413096Z",
	"message": {
		"role": "assistant",
		"content": ""
	},
	"done": true,
	"done_reason": "stop",
	"total_duration": 19934321693,
	"load_duration": 6356019235,
	"prompt_eval_count": 4096,
	"prompt_eval_duration": 1893183040,
	"eval_count": 474,
	"eval_duration": 11055448242
}0
<!-- gh-comment-id:3345891631 --> @nicho2 commented on GitHub (Sep 29, 2025): Hello, ok, now i have no error but no stream and no content too HTTP/1.1 200 OK Content-Type: application/x-ndjson Date: Mon, 29 Sep 2025 09:04:15 GMT Transfer-Encoding: chunked { "model": "gpt-oss:20b", "created_at": "2025-09-29T09:04:15.22508816Z", "message": { "role": "assistant", "content": "" }, "done": true, "done_reason": "stop", "total_duration": 12571188782, "load_duration": 148595673, "prompt_eval_count": 3120, "prompt_eval_duration": 39698926, "eval_count": 387, "eval_duration": 11321620519 } I tried with mistral-small3.2 and it's OK HTTP/1.1 200 OK Content-Type: application/x-ndjson Date: Mon, 29 Sep 2025 09:13:02 GMT Transfer-Encoding: chunked 8c {"model":"mistral-small3.2:latest","created_at":"2025-09-29T09:13:02.467320809Z","message":{"role":"assistant","content":"{"},"done":false} 8d {"model":"mistral-small3.2:latest","created_at":"2025-09-29T09:13:02.50465758Z","message":{"role":"assistant","content":" \""},"done":false} 8f {"model":"mistral-small3.2:latest","created_at":"2025-09-29T09:13:02.554222167Z","message":{"role":"assistant","content":"info"},"done":false} 8c {"model":"mistral-small3.2:latest","created_at":"2025-09-29T09:13:02.607595026Z","message":{"role":"assistant","content":"r"},"done":false} ...... 13f { "model": "mistral-small3.2:latest", "created_at": "2025-09-29T09:13:13.496413096Z", "message": { "role": "assistant", "content": "" }, "done": true, "done_reason": "stop", "total_duration": 19934321693, "load_duration": 6356019235, "prompt_eval_count": 4096, "prompt_eval_duration": 1893183040, "eval_count": 474, "eval_duration": 11055448242 }0
Author
Owner

@rick-github commented on GitHub (Sep 29, 2025):

gpt-oss doesn't currently support structured output: #11691.

<!-- gh-comment-id:3346019561 --> @rick-github commented on GitHub (Sep 29, 2025): gpt-oss doesn't currently support structured output: #11691.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#34011