Crash in encode_token_weights (lt.py) during prompt encoding
- Dominant language
- Python
- Stars
- 133k
- Forks
- 15.7k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 158
Description
### Custom Node Testing
- [x] I have tried disabling custom nodes and the issue persists (see [how to disable custom nodes](https://docs.comfy.org/troubleshooting/custom-node-issues#step-1%3A-test-with-all-custom-nodes-disabled) if you need help)
### Expected Behavior
---
## Summary
ComfyUI crashes during prompt encoding when using a custom text encoder (Gemma3 / LTX variant).
The error occurs inside `encode_token_weights`, suggesting an issue related to token processing or attention mask handling.
---
### Actual Behavior
```
### Steps to Reproduce
## Notes
* Happens consistently with the same workflow
* Occurs at text encoding stage (before sampling)
* Using custom tokenizer / text encoder
### Debug Logs
```powershell
Stack (most recent call first):
File "C:\ComfyUI_windows_portable\ComfyUI\comfy\text_encoders\lt.py", line 171 in encode_token_weights
File "C:\ComfyUI_windows_portable\ComfyUI\comfy\sd.py", line 377 in encode_from_tokens
File "C:\ComfyUI_windows_portable\ComfyUI\comfy\sd.py", line 313 in encode_from_tokens_scheduled
File "C:\ComfyUI_windows_portable\ComfyUI\nodes.py", line 80 in encode
File "C:\ComfyUI_windows_portable\ComfyUI\execution.py", line 296 in process_inputs
File "C:\ComfyUI_windows_portable\ComfyUI\execution.py", line 308 in _async_map_node_over_list
File "C:\ComfyUI_windows_portable\ComfyUI\execution.py", line 334 in get_output_data
File "C:\ComfyUI_windows_portable\ComfyUI\execution.py", line 534 in execute
File "C:\ComfyUI_windows_portable\ComfyUI\execution.py", line 770 in execute_async
File "asyncio\events.py", line 88 in _run
File "asyncio\base_events.py", line 1999 in _run_once
File "asyncio\base_events.py", line 645 in run_forever
File "asyncio\windows_events.py", line 322 in run_forever
File "asyncio\base_events.py", line 678 in run_until_complete
File "asyncio\runners.py", line 118 in run
File "asyncio\runners.py", line 195 in run
File "C:\ComfyUI_windows_portable\ComfyUI\execution.py", line 711 in execute
File "C:\ComfyUI_windows_portable\ComfyUI\main.py", line 313 in prompt_worker
File "threading.py", line 1012 in run
File "threading.py", line 1075 in _bootstrap_inner
File "threading.py", line 1032 in _bootstrap
```
### Other
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.