{"record":{"id":"08ec84275c17e319","repo":"pathwaycom/pathway","slug":"the-value-column-must-have-one-of-the-following-ty","errorCode":null,"errorMessage":"The value column must have one of the following types: {allowed_value_types}","messagePattern":"The value column must have one of the following types: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/pathway/io/_utils.py","lineNumber":593,"sourceCode":"                )\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(\n                format_type=\"single_column\",\n                key_field_names=[],\n                value_fields=_format_output_value_fields(table),\n                value_field_index=value_field_index,\n                schema_registry_settings=maybe_schema_registry_settings(\n                    schema_registry_settings\n                ),\n                subject=subject,\n            )\n        else:\n            raise ValueError(f\"Unsupported format: {format}\")\n\n        return cls(\n            table=table,","sourceCodeStart":575,"sourceCodeEnd":611,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/io/_utils.py#L575-L611","documentation":"Raised by MessageQueueOutputFormat.build for raw/plaintext output when the value column's dtype is not in allowed_value_types (default (BYTES, STR, ANY)). Like keys, raw payloads are serialized as bytes, so only byte-like or string columns are accepted by default; the error names the allowed set. Connectors can pass a different allowed_value_types tuple.","triggerScenarios":"pw.io.kafka.write(t, ..., format='raw') where the single/value column is int, float, or a complex type; schema evolution that retypes the payload column from bytes to something else.","commonSituations":"Tables whose payload column is numeric (counts, ids) because no serialization step was added; connector-specific serializers that accept a narrower/wider type set.","solutions":["Cast the value column to string/bytes: value on pw.this.count.astype(str).","Or pick a column that is already BYTES/STR as the payload.","If the target system genuinely supports the dtype, pass an extended allowed_value_types tuple."],"exampleFix":"# before\npw.io.kafka.write(t, ..., format='raw')  # single int column 'count'\n\n# after\nt = t.select(payload=pw.this.count.astype(str))\npw.io.kafka.write(t, ..., format='raw')","handlingStrategy":"type-guard","validationCode":"value_dtype = table[value_name]._column.dtype\nassert allowed_value_types is None or value_dtype in allowed_value_types, f\"value dtype {value_dtype} not in {allowed_value_types}\"","typeGuard":"def value_dtype_allowed(dtype, allowed=(dt.BYTES, dt.STR, dt.ANY)) -> bool:\n    return dtype in allowed","tryCatchPattern":"try:\n    pw.io.kafka.write(t, ..., format='raw')\nexcept ValueError as e:\n    if 'value column' in str(e):\n        t = t.with_columns(payload=pw.this[value_name].astype(str))\n        pw.io.kafka.write(t.select(pw.this.payload), ..., format='raw')\n    else:\n        raise","preventionTips":["Serialize non-string payloads to str/bytes before raw sinks.","Assert payload dtype early in the pipeline, not at sink construction."],"tags":["pathway","kafka","dtype","raw","validation"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}