{"record":{"id":"91dab9ea271c155e","repo":"pathwaycom/pathway","slug":"vector-column-name-r-has-unsupported-type-dtype","errorCode":null,"errorMessage":"vector column {name!r} has unsupported type {dtype}; a Pinecone vector must be a list[float] or a 1-D float array (dense), or a list[tuple[int, float]] of (index, weight) pairs (sparse).","messagePattern":"vector column (.+?) has unsupported type (.+?); a Pinecone vector must be a list\\[float\\] or a 1-D float array \\(dense\\), or a list\\[tuple\\[int, float\\]\\] of \\(index, weight\\) pairs \\(sparse\\)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/pathway/io/pinecone/__init__.py","lineNumber":94,"sourceCode":"        raise ValueError(\n            f\"vector column {name!r} is nullable (type {dtype}); every row must \"\n            \"carry a vector, so the column cannot be optional.\"\n        )\n    if isinstance(dtype, dt.List):\n        inner = dtype.wrapped\n        if _is_numeric(inner) or _is_sparse_pair(inner):\n            return\n        if isinstance(inner, (dt.List, dt.Array)):\n            raise NotImplementedError(\n                f\"vector column {name!r} has type {dtype}, which is a multivector; \"\n                \"a Pinecone record carries a single dense or sparse vector, so \"\n                \"multivectors are not supported.\"\n            )\n    if isinstance(dtype, dt.Array) and _is_numeric(dtype.wrapped):\n        return\n    if isinstance(dtype, dt.Tuple) and all(_is_numeric(arg) for arg in dtype.args):\n        return\n    raise ValueError(\n        f\"vector column {name!r} has unsupported type {dtype}; a Pinecone vector \"\n        \"must be a list[float] or a 1-D float array (dense), or a \"\n        \"list[tuple[int, float]] of (index, weight) pairs (sparse).\"\n    )\n\n\ndef _check_metadata_dtype(name: str, dtype: dt.DType) -> None:\n    \"\"\"Reject a metadata column whose type Pinecone cannot store.\n\n    Pinecone metadata supports ``int``, ``float``, ``bool``, ``str``, and\n    ``list[str]``; ``None`` is allowed (it is dropped). Mirrors the runtime\n    ``PineconeError::UnsupportedMetadataType`` guard.\n    \"\"\"\n    inner = dtype.wrapped if isinstance(dtype, dt.Optional) else dtype\n    if _is_statically_unknown(inner):\n        return\n    if inner in (dt.INT, dt.FLOAT, dt.BOOL, dt.STR):\n        return","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/io/pinecone/__init__.py#L76-L112","documentation":"pw.io.pinecone.write validates the vector column dtype at call time. Accepted shapes are a dense vector (list of numerics, 1-D numeric array, or numeric tuple) or a sparse vector (list[tuple[int, float]] of (index, weight) pairs). Anything else raises this ValueError listing the column and its dtype, mirroring the runtime InvalidVector/InvalidSparseVector guards.","triggerScenarios":"Passing vector=table.col with dtype list[str], list[bool], a non-numeric array, a tuple mixing types, or any non-vector type to pw.io.pinecone.write.","commonSituations":"Pointing vector at the raw text column instead of the embedding column; embeddings serialized as strings (JSON) and not parsed; sparse vectors built as list[list[float]] instead of list[tuple[int, float]].","solutions":["Point the vector argument at the actual embedding column (list[float] or 1-D float array).","Parse serialized embeddings before the sink: json.loads per row or astype to produce list[float].","For sparse vectors, ensure the dtype is list[tuple[int, float]] — convert inner lists to tuples upstream."],"exampleFix":"# before\npw.io.pinecone.write(docs, \"idx\", primary_key=docs.id, vector=docs.text)  # wrong column\n\n# after\npw.io.pinecone.write(docs, \"idx\", primary_key=docs.id, vector=docs.embedding)  # list[float]","handlingStrategy":"type-guard","validationCode":"import pathway as pw\n\ndef _is_numeric(d):\n    return d in (pw.dt.INT, pw.dt.FLOAT, pw.dt.ANY) or isinstance(d, (pw.dt.Int, pw.dt.Float))\n\ndef is_dense_vector_dtype(dtype: pw.dt.DType) -> bool:\n    return (isinstance(dtype, pw.dt.List) and _is_numeric(dtype.wrapped)) or (\n        isinstance(dtype, pw.dt.Array) and _is_numeric(dtype.wrapped)\n    )\n\nassert is_dense_vector_dtype(table.schema[vector_col].dtype), \"vector must be list[float] / 1-D float array\"","typeGuard":"import pathway as pw\n\ndef is_sparse_vector_dtype(dtype: pw.dt.DType) -> bool:\n    return (\n        isinstance(dtype, pw.dt.List)\n        and isinstance(dtype.wrapped, pw.dt.Tuple)\n        and len(dtype.wrapped.args) == 2\n        and dtype.wrapped.args[0] == pw.dt.INT\n        and dtype.wrapped.args[1] == pw.dt.FLOAT\n    )","tryCatchPattern":"try:\n    pw.io.pinecone.write(docs, \"idx\", primary_key=docs.id, vector=docs.vec)\nexcept ValueError as e:\n    if \"unsupported type\" in str(e) and \"vector\" in str(e):\n        docs = docs.with_columns(vec=docs.vec.apply(json.loads, return_type=list[float]))\n        pw.io.pinecone.write(docs, \"idx\", primary_key=docs.id, vector=docs.vec)\n    else:\n        raise","preventionTips":["Always point the vector argument at the embedding column, never at raw text or metadata.","Parse stringified embeddings (JSON) into list[float] before the sink.","For sparse vectors, use list[tuple[int, float]], not nested lists."],"tags":["pinecone","vector","dtype","embeddings","pathway"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}