{"record":{"id":"8cc5d15fd7d86cb9","repo":"pathwaycom/pathway","slug":"format-format-without-explicit-value-specifi","errorCode":null,"errorMessage":"'{format}' format without explicit 'value' specification can only be used with single-column tables","messagePattern":"'(.+?)' format without explicit 'value' specification can only be used with single-column tables","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/pathway/io/_utils.py","lineNumber":579,"sourceCode":"                value_fields=_format_output_value_fields(table),\n                delimiter=delimiter,\n                schema_registry_settings=maybe_schema_registry_settings(\n                    schema_registry_settings\n                ),\n                subject=subject,\n            )\n        elif format == \"raw\" or format == \"plaintext\":\n            value_field_index = None\n            if key is not None and value is None:\n                raise ValueError(\"'value' must be specified if 'key' is not None\")\n            if value is not None:\n                value_field_index = cls.add_column_reference_to_extract(\n                    value, columns_to_extract, extracted_field_indices\n                )\n            else:\n                column_names = list(table._columns.keys())\n                if len(column_names) != 1:\n                    raise ValueError(\n                        f\"'{format}' format without explicit 'value' specification \"\n                        \"can only be used with single-column tables\"\n                    )\n                value = table[column_names[0]]\n                value_field_index = cls.add_column_reference_to_extract(\n                    value, columns_to_extract, extracted_field_indices\n                )\n\n            table = table.select(*columns_to_extract)\n            if (\n                allowed_value_types is not None\n                and table[value._name]._column.dtype not in allowed_value_types\n            ):\n                raise ValueError(\n                    f\"The value column must have one of the following types: {allowed_value_types}\"\n                )\n\n            data_format = api.DataFormat(","sourceCodeStart":561,"sourceCodeEnd":597,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/io/_utils.py#L561-L597","documentation":"Raised by MessageQueueOutputFormat.build for format='raw' or 'plaintext' when 'value' is not given and the table has more than one column. In raw mode the payload must be exactly one column; with no explicit value= the writer can only proceed if the table has a single column to use implicitly, so multi-column tables are rejected.","triggerScenarios":"pw.io.kafka.write(t, ..., format='raw') where t has columns id, payload, ts; prototyping with a single-column table that later gains columns; plaintext forwarding of full rows without selecting one column.","commonSituations":"Pipelines that evolve: an initially single-column table gains metadata columns and the raw writer starts failing; passing an entire wide table where only one column is the payload.","solutions":["Select the single payload column before writing: t = t.select(pw.this.payload).","Or pass value=pw.this.payload explicitly to designate the payload column.","If all columns must be serialized, use format='json' or 'dsv' instead."],"exampleFix":"# before\npw.io.kafka.write(t, ..., format='raw')  # t has 3 columns\n\n# after\nt = t.select(pw.this.payload)\npw.io.kafka.write(t, ..., format='raw')","handlingStrategy":"validation","validationCode":"if format in ('raw', 'plaintext') and value is None:\n    assert len(table.column_names()) == 1, \"raw/plaintext implicit value needs a single-column table; select one column first\"","typeGuard":"def raw_ready(table, value) -> bool:\n    return value is not None or len(table.column_names()) == 1","tryCatchPattern":"try:\n    pw.io.kafka.write(t, ..., format='raw')\nexcept ValueError as e:\n    if 'single-column tables' in str(e):\n        pw.io.kafka.write(t.select(pw.this.payload), ..., format='raw')\n    else:\n        raise","preventionTips":["Project to the payload column explicitly before raw writes instead of relying on single-column detection.","When a table gains columns, revisit raw sinks that depended on the single-column shape."],"tags":["pathway","kafka","raw","single-column","validation"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}