pathwaycom/pathway · error · ValueError
Table.from_columns() cannot have empty arguments list
Error message
Table.from_columns() cannot have empty arguments list
What it means
Table.from_columns(*args, **kwargs) builds a new table from column references passed positionally and by keyword. combine_args_kwargs merges both; if the merged dict is empty (no positional and no keyword arguments), ValueError('Table.from_columns() cannot have empty arguments list') is raised because there is no source table to select from.
Source
Thrown at python/pathway/internals/table.py:300
Returns:
Table: Created table.
Example:
>>> import pathway as pw
>>> t1 = pw.Table.empty(age=float, pet=float)
>>> t2 = pw.Table.empty(foo=float, bar=float).with_universe_of(t1)
>>> t3 = pw.Table.from_columns(t1.pet, qux=t2.foo)
>>> pw.debug.compute_and_print(t3, include_id=False)
pet | qux
"""
all_args = cast(
dict[str, expr.ColumnReference], combine_args_kwargs(args, kwargs)
)
if not all_args:
raise ValueError("Table.from_columns() cannot have empty arguments list")
else:
arg = next(iter(all_args.values()))
table: Table = arg.table
for arg in all_args.values():
if not table._universe.is_equal_to(arg.table._universe):
raise ValueError(
"Universes of all arguments of Table.from_columns() have to be equal.\n"
+ "Consider using Table.promise_universes_are_equal() to assert it.\n"
+ "(However, untrue assertion might result in runtime errors.)"
)
return table.select(*args, **kwargs)
@trace_user_frame
@check_arg_types
def concat_reindex(self, *tables: Table) -> Table:
"""Concatenate contents of several tables.
This is similar to PySpark union. All tables must have the same schema. Each row is reindexed.View on GitHub (pinned to fa2f74a464)
Solutions
- Ensure at least one column reference is passed before calling from_columns
- If the column set may legitimately be empty, branch and create pw.Table.empty() with the desired schema instead
- Log the generated argument list when constructing calls dynamically
Example fix
# before
t = pw.Table.from_columns(*cols) # cols == [] -> ValueError
# after
if not cols:
t = pw.Table.empty()
else:
t = pw.Table.from_columns(*cols) Defensive patterns
Strategy: validation
Validate before calling
def has_columns(args, kwargs) -> bool:
return len(args) + len(kwargs) > 0 Prevention
- Guard dynamic from_columns calls with an emptiness check
- Use pw.Table.empty() for the zero-column case
When it happens
Trigger: Calling pw.Table.from_columns() with zero arguments; programmatically building the argument list from a loop/dict that turns out empty; passing an empty dict via **kwargs expansion.
Common situations: Dynamic pipelines that assemble columns from configuration or data-driven lists which can be empty; guard clauses that skip appending arguments entirely.
Related errors
- You cannot use {dep.to_column_expression()} in this reduce s
- join condition should be of form <left_table>.<column> == <r
- Schema.with_types() argument name has to be an existing colu
- Schema.without() argument {name!r} has to refer to an existi
- 'topic' must be a non-empty string; got an empty list. Kafka
AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15).
Data as JSON: /api/errors/22687c09b7008436.
Report an issue: GitHub.