pathwaycom/pathway · error · ValueError

metadata column {col._name!r} does not belong to the provide

Error message

metadata column {col._name!r} does not belong to the provided table. Pass column references from the same table, e.g. table.{col._name}.

What it means

Raised by pw.io.pinecone.write() when a column in the explicit metadata_columns list belongs to a table other than the one being written. Each metadata column must be a reference (e.g. table.title) from the same table object passed as the first argument.

Source

Thrown at python/pathway/io/pinecone/__init__.py:371

    vector_name = vector._name

    if pk_name == vector_name:
        raise ValueError(
            f"primary_key and vector both reference column {pk_name!r}; they must "
            "be different columns."
        )

    if metadata_columns is None:
        metadata_names = [
            col_name
            for col_name in table.column_names()
            if col_name not in (pk_name, vector_name)
        ]
    else:
        metadata_names = []
        for col in metadata_columns:
            if col._table is not table:
                raise ValueError(
                    f"metadata column {col._name!r} does not belong to the "
                    f"provided table. Pass column references from the same table, "
                    f"e.g. table.{col._name}."
                )
            if col._name in (pk_name, vector_name):
                role = "primary_key" if col._name == pk_name else "vector"
                raise ValueError(
                    f"column {col._name!r} is used as the {role} and cannot also "
                    "be a metadata column. Remove it from metadata_columns."
                )
            metadata_names.append(col._name)

    if batch_size <= 0:
        raise ValueError(f"batch_size must be a positive integer, got {batch_size}.")

    if pk_name is not None:
        _check_primary_key_dtype(pk_name, table._get_column(pk_name).dtype)
    _check_vector_dtype(vector_name, table._get_column(vector_name).dtype)

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Re-pass every metadata column from the same table: metadata_columns=[table.title].
  2. If you need columns from several sources, join/select them into one table first, then write that table.

Example fix

# before
pw.io.pinecone.write(base, index_name="docs", vector=base.emb, metadata_columns=[joined.title], api_key=k)
# after
joined2 = base.select(base.emb, title=joined.title)
pw.io.pinecone.write(joined2, index_name="docs", vector=joined2.emb, metadata_columns=[joined2.title], api_key=k)
Defensive patterns

Strategy: validation

Validate before calling

valid = set(table.column_names())
for col in metadata_columns or []:
    assert col._table is table, f"{col._name!r} not from table"
    assert col._name in valid

Prevention

When it happens

Trigger: Passing metadata_columns=[other.col] where other is not table; mixing columns from a base table and a derived table (after select/join/with_columns) in one metadata_columns list.

Common situations: Hybrid search setups where two write() calls (dense and sparse index) are copy-pasted and metadata column references are not updated to the current table variable.

Related errors


AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15). Data as JSON: /api/errors/f4388883520e6d1b. Report an issue: GitHub.