{"record":{"id":"36bea9e8e3c9dd59","repo":"pathwaycom/pathway","slug":"text-column-text-column-name-r-does-not-belong","errorCode":null,"errorMessage":"text_column {text_column._name!r} does not belong to the provided table. Pass a column reference from the same table, e.g. text_column=table.{text_column._name}.","messagePattern":"text_column (.+?) does not belong to the provided table\\. Pass a column reference from the same table, e\\.g\\. text_column=table\\.(.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/pathway/io/leann/__init__.py","lineNumber":259,"sourceCode":"    ...     table,\n    ...     index_path=\"./articles.leann\",\n    ...     text_column=table.body,\n    ...     metadata_columns=[table.title, table.category],\n    ...     backend_name=\"hnsw\",\n    ...     embedding_model=\"facebook/contriever\",\n    ... )\n\n    Run the pipeline. In static mode the Pathway Live Data Framework processes the file once and\n    writes the index; in streaming mode it keeps the index up to date as\n    new articles arrive:\n\n    >>> pw.run()  # doctest: +SKIP\n    \"\"\"\n    _check_entitlements(\"leann\")\n    _check_leann_available()\n\n    if text_column._table is not table:\n        raise ValueError(\n            f\"text_column {text_column._name!r} does not belong to the provided \"\n            f\"table. Pass a column reference from the same table, \"\n            f\"e.g. text_column=table.{text_column._name}.\"\n        )\n    _check_str_column(text_column, \"text_column\")\n\n    metadata_col_names: list[str] | None = None\n    if metadata_columns is not None:\n        for col in metadata_columns:\n            if col._table is not table:\n                raise ValueError(\n                    f\"metadata column {col._name!r} does not belong to the provided \"\n                    f\"table. Pass column references from the same table, \"\n                    f\"e.g. table.{col._name}.\"\n                )\n            _check_str_column(col, \"metadata column\")\n        metadata_col_names = [col._name for col in metadata_columns]\n","sourceCodeStart":241,"sourceCodeEnd":277,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/io/leann/__init__.py#L241-L277","documentation":"pw.io.leann.write requires text_column to be a ColumnReference of the exact table passed as the first argument. Because ColumnReference objects are bound to a specific Table instance, a reference from a filtered/selected/derived table will not match, and Pathway raises this ValueError with a suggested correction.","triggerScenarios":"pw.io.leann.write(base_table, path, text_column=derived.text) where derived = base_table.filter(...).select(...) — any transform produces a new table whose column references fail the identity check.","commonSituations":"Keeping a reference to the pre-transform table for the write call while passing columns captured after transforms; helper functions that receive both a table and columns from different pipelines.","solutions":["Pass the final table together with its own column: pw.io.leann.write(derived, path, text_column=derived.text)","Re-derive the column from the table inside the call: text_column=table[\"text\"]","Keep one variable for the fully transformed table and use it exclusively for both the table and column arguments"],"exampleFix":"# before\nclean = raw.select(text=raw.body)\npw.io.leann.write(raw, \"idx\", text_column=clean.text)\n\n# after\nclean = raw.select(text=raw.body)\npw.io.leann.write(clean, \"idx\", text_column=clean.text)","handlingStrategy":"validation","validationCode":"assert text_column._table is table, (\n    f\"text_column {text_column._name!r} is from a different table; \"\n    f\"use table.{text_column._name}\"\n)","typeGuard":"def column_from_table(table: pw.Table, col: pw.ColumnReference) -> bool:\n    return col._table is table","tryCatchPattern":"try:\n    pw.io.leann.write(table, \"idx\", table.text)\nexcept ValueError as e:\n    if \"does not belong to the provided table\" in str(e):\n        text_column = table[text_column._name]  # rebind by name to the right table\n    else:\n        raise","preventionTips":["Derive every column argument from the same variable passed as the table","After any transform chain, rebind column references from the final table","Use table['name'] instead of stale references in dynamic code"],"tags":["leann","pathway","column-reference","validation"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}