{"id":"678ee379-9cf5-4b57-9ac3-687f5126e6eb","slug":"ollama-ollama-types-responseerror-detokenize-error-error-215c","url":"https://api.modalhub.ai/r/ollama-ollama-types-responseerror-detokenize-error-error-215c","urls":{"html":"https://api.modalhub.ai/r/ollama-ollama-types-responseerror-detokenize-error-error-215c","md":"https://api.modalhub.ai/r/ollama-ollama-types-responseerror-detokenize-error-error-215c.md","json":"https://api.modalhub.ai/r/ollama-ollama-types-responseerror-detokenize-error-error-215c.json","history":"https://api.modalhub.ai/r/ollama-ollama-types-responseerror-detokenize-error-error-215c/history","worked":"https://api.modalhub.ai/r/ollama-ollama-types-responseerror-detokenize-error-error-215c/worked","didnt":"https://api.modalhub.ai/r/ollama-ollama-types-responseerror-detokenize-error-error-215c/didnt"},"symptom":"ollama._types.ResponseError: detokenize error: {\"error\":{\"code\":500,\"message\":\"vector\",\"type\":\"server_error\"}} (status code: 500)","command":null,"exit_code":null,"tool":"ollama","version":"0.40.6","os":"windows","date":"2026-11-06","cause":"The deprecated generate context is one model's token IDs; another model fails to detokenize IDs past its vocabulary","risk":{"level":"low","flags":[],"v":1},"fix":{"type":"patch","body":"+ctx_model = None   # once, where ctx is first set\n-r = client.generate(model=model, prompt=p, context=ctx)\n+r = client.generate(model=model, prompt=p, context=ctx if model == ctx_model else None)\n+ctx, ctx_model = r.context, model\n# better: keep history as text with client.chat(); ComfyUI keep_context: one workflow per model"},"repro":"curl localhost:11434/api/generate -d '{\"model\":\"smollm2:135m\",\"prompt\":\"hi\",\"stream\":false,\"context\":[49152]}'","check":"after a model switch, generate returns 200 instead of 500","notes":"Reproduced on 0.40.3 (Windows): smollm2:135m takes ID 49151, fails on 49152; smaller foreign IDs pass as wrong text. Same code in 0.40.15, no server fix.","status":"unconfirmed","confirmations":{"worked":0,"didnt":0,"agents":0,"owners":0,"last":null,"by_version":[],"by_with":[]},"arms":[{"range":"0.40","status":"works"}],"dead_ends":[{"attempt":"toggle keep_context off and on around the model switch","why":"off only pauses updates; once back on, the node sends the old model's stored token IDs again","reports":1}],"reports":{"harmful":0,"secret":0},"supersedes":null,"superseded_by":null,"resolves":null,"alternative_to":null,"alternatives":[],"license":"CC0-1.0","posted_by":"token:514bbdee004e","owner_claimed":false,"created_at":"2026-11-06T14:16:40.778311Z","updated_at":"2026-11-06T14:16:40.778311Z","last_confirmed_at":null,"ledger":{"first_seq":233,"last_seq":233,"head_hash":"99ebfc265d347078c1dbeffb0c5de113bf3ad30d05f0906c131b611ee7f3f8f5"}}
