{"record":{"id":"21c5bba703c13c9c","repo":"cocoindex-io/cocoindex","slug":"table-table-name-has-vector-column-s-vector","errorCode":null,"errorMessage":"Table '{table_name}' has vector column(s) {vector_cols}, but sqlite-vec extension is not loaded. Use connect(..., load_vec=True) to enable it.","messagePattern":"Table '(.+?)' has vector column\\(s\\) (.+?), but sqlite-vec extension is not loaded\\. Use connect\\(\\.\\.\\., load_vec=True\\) to enable it\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/cocoindex/connectors/sqlite/_target.py","lineNumber":768,"sourceCode":"    columns_sql = \",\\n    \".join(col_defs)\n    sql = f\"CREATE VIRTUAL TABLE {qualified_name} USING {module_name}(\\n    {columns_sql}\\n)\"\n\n    conn.execute(sql)\n\n\ndef _create_table(\n    conn: sqlite3.Connection,\n    table_name: str,\n    schema: TableSchema[Any],\n    *,\n    if_not_exists: bool,\n    has_vec_extension: bool,\n) -> None:\n    \"\"\"Create a table.\"\"\"\n    # Check if vector columns are used but sqlite-vec is not loaded\n    vector_cols = [name for name, col in schema.columns.items() if col.is_vector]\n    if vector_cols and not has_vec_extension:\n        raise RuntimeError(\n            f\"Table '{table_name}' has vector column(s) {vector_cols}, but sqlite-vec \"\n            \"extension is not loaded. Use connect(..., load_vec=True) to enable it.\"\n        )\n\n    qualified_name = _qualified_table_name(table_name)\n\n    # Build column definitions\n    col_defs = []\n    for col_name, col in schema.columns.items():\n        nullable = (\n            \"\" if col.nullable and col_name not in schema.primary_key else \" NOT NULL\"\n        )\n        col_defs.append(f'\"{col_name}\" {col.type}{nullable}')\n\n    # Build primary key constraint\n    pk_cols = \", \".join(f'\"{c}\"' for c in schema.primary_key)\n    col_defs.append(f\"PRIMARY KEY ({pk_cols})\")\n","sourceCodeStart":750,"sourceCodeEnd":786,"githubUrl":"https://github.com/cocoindex-io/cocoindex/blob/e84aa99b3292c5270a4b313b2a7137ad9ce8ab3b/python/cocoindex/connectors/sqlite/_target.py#L750-L786","documentation":"`_create_table` refuses to create a regular SQLite table that has vector-typed columns when the sqlite-vec extension is not loaded, since vector columns need the vec0 virtual-table machinery. It lists the offending vector columns in the message and points to `connect(..., load_vec=True)`.","triggerScenarios":"Declaring a SQLite table target whose schema contains columns with vector types (e.g. produced by a `VectorSchemaProvider` or `SqliteType` float-vector mapping) while the connection was opened without `load_vec=True`.","commonSituations":"Adding an embedding column to an existing SQLite-backed pipeline without updating `connect()`; copying a `connect()` call from a non-vector example; forgetting to install `sqlite-vec` so the load silently fails or is skipped.","solutions":["Call `connect(path, load_vec=True)` so the sqlite-vec extension is loaded","Install the `sqlite-vec` package if the extension cannot be loaded","If vectors are not actually needed, change the column type to a non-vector SqliteType"],"exampleFix":"// before\nconn = sqlite.connect(\"app.db\")\n// after\nconn = sqlite.connect(\"app.db\", load_vec=True)","handlingStrategy":"validation","validationCode":"if any(getattr(c, \"is_vector\", False) for c in schema.columns.values()):\n    assert conn_options.get(\"load_vec\"), \"Vector columns require load_vec=True\"","typeGuard":null,"tryCatchPattern":"try:\n    await app.update()\nexcept RuntimeError as e:\n    if \"sqlite-vec\" in str(e) and \"load_vec=True\" in str(e):\n        conn = sqlite.connect(path, load_vec=True)\n    else:\n        raise","preventionTips":["Pair every vector-typed column with load_vec=True in connect()","Keep a single connect() factory used by all pipeline entry points so the flag is never forgotten","Install sqlite-vec in all deployment environments"],"tags":["sqlite","sqlite-vec","vector","schema"],"backgroundTag":"missing-dependency","analyzedSha":"e84aa99b3292c5270a4b313b2a7137ad9ce8ab3b","analyzedAt":"2026-09-08T15:59:19.997Z","contentChangedAt":"2026-09-08T15:59:19.997Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}