{"record":{"id":"39d5a65cb89c4822","repo":"pathwaycom/pathway","slug":"column-col-name-r-is-used-as-the-role-and-can","errorCode":null,"errorMessage":"column {col._name!r} is used as the {role} and cannot also be a metadata column. Remove it from metadata_columns.","messagePattern":"column (.+?) is used as the (.+?) and cannot also be a metadata column\\. Remove it from metadata_columns\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/pathway/io/pinecone/__init__.py","lineNumber":378,"sourceCode":"\n    if metadata_columns is None:\n        metadata_names = [\n            col_name\n            for col_name in table.column_names()\n            if col_name not in (pk_name, vector_name)\n        ]\n    else:\n        metadata_names = []\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 \"\n                    f\"provided table. Pass column references from the same table, \"\n                    f\"e.g. table.{col._name}.\"\n                )\n            if col._name in (pk_name, vector_name):\n                role = \"primary_key\" if col._name == pk_name else \"vector\"\n                raise ValueError(\n                    f\"column {col._name!r} is used as the {role} and cannot also \"\n                    \"be a metadata column. Remove it from metadata_columns.\"\n                )\n            metadata_names.append(col._name)\n\n    if batch_size <= 0:\n        raise ValueError(f\"batch_size must be a positive integer, got {batch_size}.\")\n\n    if pk_name is not None:\n        _check_primary_key_dtype(pk_name, table._get_column(pk_name).dtype)\n    _check_vector_dtype(vector_name, table._get_column(vector_name).dtype)\n    for col_name in metadata_names:\n        _check_metadata_dtype(col_name, table._get_column(col_name).dtype)\n\n    resolved_api_key = (\n        api_key if api_key is not None else os.environ.get(\"PINECONE_API_KEY\")\n    )\n    if not resolved_api_key:","sourceCodeStart":360,"sourceCodeEnd":396,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/io/pinecone/__init__.py#L360-L396","documentation":"Raised by pw.io.pinecone.write() when a column listed in metadata_columns is already used as the primary_key or the vector column. The connector would otherwise serialize the same column twice with conflicting roles, so it asks you to remove the duplicate from metadata_columns.","triggerScenarios":"primary_key=table.doc_id together with metadata_columns=[table.doc_id, ...]; or vector=table.emb with metadata_columns containing table.emb.","commonSituations":"Migrating from a call that relied on the default metadata (all columns) to explicit metadata_columns and accidentally including the id or embedding column; the hybrid-search doc example warns the default would try to store the other vector column as metadata.","solutions":["Remove the pk/vector column from metadata_columns.","If you are in a hybrid setup writing two indexes from one table, spell out metadata_columns explicitly excluding both vector columns."],"exampleFix":"# before\npw.io.pinecone.write(t, index_name=\"docs\", primary_key=t.doc_id, vector=t.emb, metadata_columns=[t.doc_id, t.title], api_key=k)\n# after\npw.io.pinecone.write(t, index_name=\"docs\", primary_key=t.doc_id, vector=t.emb, metadata_columns=[t.title], api_key=k)","handlingStrategy":"validation","validationCode":"reserved = {primary_key._name if primary_key is not None else None, vector._name}\nmetadata_columns = [c for c in metadata_columns if c._name not in reserved]","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When switching from default metadata to explicit metadata_columns, derive it: [table[c] for c in table.column_names() if c not in (pk, vec)].","Read the connector docstring section on hybrid retrieval, which warns the default would include the other vector column."],"tags":["pinecone","pathway","duplicate-argument","metadata"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}