{"record":{"id":"22687c09b7008436","repo":"pathwaycom/pathway","slug":"table-from-columns-cannot-have-empty-arguments-l","errorCode":null,"errorMessage":"Table.from_columns() cannot have empty arguments list","messagePattern":"Table\\.from_columns\\(\\) cannot have empty arguments list","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/pathway/internals/table.py","lineNumber":300,"sourceCode":"\n        Returns:\n            Table: Created table.\n\n\n        Example:\n\n        >>> import pathway as pw\n        >>> t1 = pw.Table.empty(age=float, pet=float)\n        >>> t2 = pw.Table.empty(foo=float, bar=float).with_universe_of(t1)\n        >>> t3 = pw.Table.from_columns(t1.pet, qux=t2.foo)\n        >>> pw.debug.compute_and_print(t3, include_id=False)\n        pet | qux\n        \"\"\"\n        all_args = cast(\n            dict[str, expr.ColumnReference], combine_args_kwargs(args, kwargs)\n        )\n        if not all_args:\n            raise ValueError(\"Table.from_columns() cannot have empty arguments list\")\n        else:\n            arg = next(iter(all_args.values()))\n            table: Table = arg.table\n            for arg in all_args.values():\n                if not table._universe.is_equal_to(arg.table._universe):\n                    raise ValueError(\n                        \"Universes of all arguments of Table.from_columns() have to be equal.\\n\"\n                        + \"Consider using Table.promise_universes_are_equal() to assert it.\\n\"\n                        + \"(However, untrue assertion might result in runtime errors.)\"\n                    )\n            return table.select(*args, **kwargs)\n\n    @trace_user_frame\n    @check_arg_types\n    def concat_reindex(self, *tables: Table) -> Table:\n        \"\"\"Concatenate contents of several tables.\n\n        This is similar to PySpark union. All tables must have the same schema. Each row is reindexed.","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/internals/table.py#L282-L318","documentation":"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.","triggerScenarios":"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.","commonSituations":"Dynamic pipelines that assemble columns from configuration or data-driven lists which can be empty; guard clauses that skip appending arguments entirely.","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"],"exampleFix":"# before\nt = pw.Table.from_columns(*cols)  # cols == [] -> ValueError\n\n# after\nif not cols:\n    t = pw.Table.empty()\nelse:\n    t = pw.Table.from_columns(*cols)","handlingStrategy":"validation","validationCode":"def has_columns(args, kwargs) -> bool:\n    return len(args) + len(kwargs) > 0","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Guard dynamic from_columns calls with an emptiness check","Use pw.Table.empty() for the zero-column case"],"tags":["api-misuse","validation","pathway"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}