{"record":{"id":"a996da9bc81d7f85","repo":"pathwaycom/pathway","slug":"unknown-source-component-self-source-component","errorCode":null,"errorMessage":"Unknown source component: {self.source_component}","messagePattern":"Unknown source component: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/pathway/internals/schema.py","lineNumber":734,"sourceCode":"        if self.example is not None:\n            example_base64 = base64.b64encode(api.serialize(self.example)).decode(\n                \"UTF-8\"\n            )\n            result[\"_serialized_example\"] = example_base64\n        return result\n\n    @property\n    def typehint(self):\n        return self.dtype.typehint\n\n    @property\n    def engine_field_source(self):\n        if self.source_component == PAYLOAD_SOURCE_COMPONENT:\n            return api.FieldSource.PAYLOAD\n        elif self.source_component == KEY_SOURCE_COMPONENT:\n            return api.FieldSource.KEY\n        else:\n            raise ValueError(f\"Unknown source component: {self.source_component}\")\n\n\n@dataclass(frozen=True)\nclass ColumnDefinition:\n    primary_key: bool = False\n    default_value: Any | None = _no_default_value_marker\n    dtype: dt.DType | None = dt.ANY\n    name: str | None = None\n    append_only: bool | None = None\n    description: str | None = None  # used in OpenAPI schema autogeneration\n    example: Any = None  # used in OpenAPI schema autogeneration\n    source_component: str = PAYLOAD_SOURCE_COMPONENT\n\n    def __post_init__(self):\n        assert self.dtype is None or isinstance(self.dtype, dt.DType)\n\n    @classmethod\n    def from_properties(cls, properties: ColumnProperties) -> ColumnDefinition:","sourceCodeStart":716,"sourceCodeEnd":752,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/internals/schema.py#L716-L752","documentation":"Thrown when building a table column's engine field descriptor: schema.py maps a column's source_component (PAYLOAD_SOURCE_COMPONENT or KEY_SOURCE_COMPONENT) to api.FieldSource.PAYLOAD/KEY. Any other value reaches the else-branch and raises ValueError. In practice this means a ColumnDefinition was created with a source_component string that Pathway does not recognize.","triggerScenarios":"Constructing a ColumnDefinition (or a schema class derived from one) with a hand-written source_component value; programmatically copying/merging ColumnDefinition objects and corrupting the field; using a connector API that lets you mark fields as coming from a key (e.g. kafka/rabbitmq style key_field) while passing an arbitrary string instead of the exported constants.","commonSituations":"Custom schema generation code that builds column definitions dynamically; version upgrades that renamed or moved the PAYLOAD/KEY source-component constants; typos when setting source_component='key_source' instead of importing the constant.","solutions":["Import and use the exact constants: from pathway.internals.schema import PAYLOAD_SOURCE_COMPONENT, KEY_SOURCE_COMPONENT (or pathway.io) instead of literal strings","Audit any code that copies/serializes ColumnDefinition objects and verify source_component survives unchanged","If the schema comes from a connector with a key field, check the connector docs for how key columns must be declared rather than setting source_component manually"],"exampleFix":"// before\ncol = pw.ColumnDefinition(source_component=\"key\")\n\n// after\nfrom pathway.internals.schema import KEY_SOURCE_COMPONENT\ncol = pw.ColumnDefinition(source_component=KEY_SOURCE_COMPONENT)","handlingStrategy":"validation","validationCode":"from pathway.internals.schema import PAYLOAD_SOURCE_COMPONENT, KEY_SOURCE_COMPONENT\n_VALID = {PAYLOAD_SOURCE_COMPONENT, KEY_SOURCE_COMPONENT}\ndef valid_column_definition(cd) -> bool:\n    return cd.source_component in _VALID","typeGuard":"def is_known_source_component(value: str) -> bool:\n    from pathway.internals.schema import PAYLOAD_SOURCE_COMPONENT, KEY_SOURCE_COMPONENT\n    return value in (PAYLOAD_SOURCE_COMPONENT, KEY_SOURCE_COMPONENT)","tryCatchPattern":"try:\n    col.engine_field_source\nexcept ValueError as e:\n    raise RuntimeError(f\"Bad ColumnDefinition source_component: {e}\") from e","preventionTips":["Never hand-write source_component strings; import the constants","Add an assertion after any code that copies ColumnDefinition objects"],"tags":["schema","configuration","pathway"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}