If you were running a FLUX workflow in ComfyUI recently and got slammed with a nasty Python TypeError, you aren’t alone.
Everything runs smoothly during your generation run until the CLIPLoader node tries to load the text encoder, throwing this exact traceback:
Plaintext
TypeError: MistralConverter.__init__() missing 1 required positional argument: 'vocab_file'
It’s annoying, especially when you’re in the middle of testing models on a cloud instance like RunPod. The good news? It’s just a package mismatch between Hugging Face’s transformers library and ComfyUI.
Here is what went wrong and how to fix it in a few quick steps.
Why Is This Error Happening?
Under the hood, ComfyUI’s text encoder wrapper (comfy/text_encoders/flux.py) initializes MistralConverter from the transformers library to process tokenizer data for Mistral-based text encoders.
In newer releases of transformers (around version 4.48+), Hugging Face updated MistralConverter (and convert_slow_tokenizer) so that vocab_file is now a mandatory positional argument.
Because ComfyUI’s older code passes vocab=vocab without explicitly declaring vocab_file, Python throws a TypeError and halts the workflow execution.
Fix 1: Downgrade the transformers Package (Recommended Quick Fix)
If you just want your workflow running immediately without breaking existing nodes, downgrading transformers to a known working version is the fastest route.
Step 1: Open Your Terminal
Log into your server, container, or RunPod pod via SSH or the web terminal.
Step 2: Force Reinstall Compatible Transformers
Run the following command to pin transformers below version 4.48.0:
Bash
pip install "transformers<4.48.0" --force-reinstall
Step 3: Restart ComfyUI
Kill your running ComfyUI process and start it again so Python picks up the downgraded package.
Bash
# Example if running inside a terminal session:
python main.py --listen 0.0.0.0 --port 8188
Fix 2: Update ComfyUI via ComfyUI Manager (No Terminal Needed)
If you have ComfyUI Manager installed in your Web UI, you can update the entire core system right from your browser without touching the command line.
- Open your ComfyUI browser interface.
- Click the Manager button on the side panel (or floating menu).
- Click Update ComfyUI.
- Wait for the notification stating that ComfyUI has been updated successfully.
- Click Restart inside the Manager menu, or reload your backend server.
Note: If ComfyUI Manager also asks to update dependencies or node suites, go ahead and let it run to keep your environment aligned.
Fix 3: Update ComfyUI via Git (For Terminal Users)
If you prefer using the command line or don’t have ComfyUI Manager installed, you can pull the official patches directly from GitHub.
Step 1: Pull Latest Git Changes
Navigate to your ComfyUI root directory and pull the latest code:
Bash
cd /workspace/ComfyUI
git pull
Step 2: Update Dependencies
Make sure your environment requirements match the updated ComfyUI core:
Bash
pip install -r requirements.txt --upgrade
Restart ComfyUI afterward, and the loader will handle the tokenizer argument changes cleanly.
Fix 4: Quick Code Patch (If You Can’t Touch Packages or Update Core)
If you are stuck in a locked environment where you cannot run pip, use ComfyUI Manager, or pull from Git, you can manually patch the line in the ComfyUI source code.
- Open
/comfy/text_encoders/flux.pyin your text editor. - Search for
load_mistral_tokenizeraround line 110. - Look for this return block:
Python
return {"tokenizer_object": MistralConverter(vocab=vocab, additional_special_tokens=all_special).converted(), "legacy": False}
- Add
vocab_file=Noneas the first argument:
Python
return {"tokenizer_object": MistralConverter(vocab_file=None, vocab=vocab, additional_special_tokens=all_special).converted(), "legacy": False}
- Save the file and restart your ComfyUI server.
Quick Recap
- The Cause:
transformersupdatedMistralConverterto requirevocab_file. - The Fast Terminal Fix: Run
pip install "transformers<4.48.0"and restart. - The UI Fix: Open ComfyUI Manager and click Update ComfyUI.
- The CLI Fix: Run
git pullinside your ComfyUI folder.
Whenever you manage Python environments for AI workflows, keeping a working snapshot or Docker image saved once everything is stable will save you plenty of late-night troubleshooting!
No Comments