Fixing tuple multiplication error
2025-07-312 turns2,937 charsgpt-4o
Summary
User encountered a Python TypeError in ComfyUI related to tuple multiplication and needed help fixing the error.
Messages
!!! Exception during processing !!! can't multiply sequence by non-int of type 'tuple'
Traceback (most recent call last):
File "/Users/danielkliewer/com01/ComfyUI/execution.py", line 361, in execute
output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/danielkliewer/com01/ComfyUI/execution.py", line 236, in get_output_data
return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
File "/Users/danielkliewer/com01/ComfyUI/execution.py", line 208, in _map_node_over_list
process_inputs(input_dict, i)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "/Users/danielkliewer/com01/ComfyUI/execution.py", line 197, in process_inputs
results.append(getattr(obj, func)(**inputs))
~~~~~~~~~~~~~~~~~~^^^^^^^^^^
File "/Users/danielkliewer/com01/ComfyUI/custom_nodes/comfyui-videohelpersuite/videohelpersuite/nodes.py", line 308, in combine_video
frames_per_batch = (1920 * 1080 * 16) // (width * height) or 1
~~~~~~^~~~~~~~
TypeError: can't multiply sequence by non-int of type 'tuple'
The error message you're seeing:
```
TypeError: can't multiply sequence by non-int of type 'tuple'
```
means that `width * height` is trying to multiply two **tuples** rather than integers.
Let's look at the line causing the problem:
```python
frames_per_batch = (1920 * 1080 * 16) // (width * height) or 1
```
The error implies that either `width`, `height`, or both are tuples, not integers.
---
### ✅ Fix
You need to **unpack** or extract the integer values from the tuple(s). Here's an example fix:
```python
# If width is a tuple like (1920, ), extract it
if isinstance(width, tuple):
width = width[0]
if isinstance(height, tuple):
height = height[0]
```
Or more safely:
```python
width = width[0] if isinstance(width, tuple) else width
height = height[0] if isinstance(height, tuple) else height
```
Then the line becomes safe:
```python
frames_per_batch = (1920 * 1080 * 16) // (width * height) or 1
```
---
### 🔍 How to find the source
You might want to trace where `width` and `height` are coming from inside this function:
```python
def combine_video(...): # line 308
```
Ensure they are passed as integers, or sanitize them at the start of the function like this:
```python
def combine_video(...):
width = int(width[0]) if isinstance(width, tuple) else int(width)
height = int(height[0]) if isinstance(height, tuple) else int(height)
```
Let me know if you want help editing the function directly. If you share the full function definition, I can rewrite it cleanly.
gpt-4o