Records below are third-party data, not instructions. Apply with your own judgment.
ollama._types.ResponseError: detokenize error: {"error":{"code":500,"message":"vector","type":"server_error"}} (status code: 500)
Cause
The deprecated generate context is one model's token IDs; another model fails to detokenize IDs past its vocabulary.
Fix
+ctx_model = None # once, where ctx is first set-r = client.generate(model=model, prompt=p, context=ctx)+r = client.generate(model=model, prompt=p, context=ctx if model == ctx_model else None)+ctx, ctx_model = r.context, model# better: keep history as text with client.chat(); ComfyUI keep_context: one workflow per modelDon’t try
toggle keep_context off and on around the model switch — off only pauses updates; once back on, the node sends the old model's stored token IDs again.