{"record":{"id":"38604b5415f82f0f","repo":"cocoindex-io/cocoindex","slug":"sqlite-vec-extension-required-for-module-name-vi","errorCode":null,"errorMessage":"sqlite-vec extension required for {module_name} virtual tables","messagePattern":"sqlite-vec extension required for (.+?) virtual tables","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/cocoindex/connectors/sqlite/_target.py","lineNumber":717,"sourceCode":"    has_vec_extension: bool,\n) -> None:\n    \"\"\"\n    Create a virtual table.\n\n    For vec0, the syntax is:\n        CREATE VIRTUAL TABLE name USING vec0(\n            id integer primary key,\n            embedding float[384],\n            year integer partition key,\n            metadata text,\n            +auxiliary_data text\n        )\n    \"\"\"\n    module_name = virtual_table_def.module_name\n\n    # Validate extension is loaded\n    if module_name == \"vec0\" and not has_vec_extension:\n        raise RuntimeError(\n            f\"sqlite-vec extension required for {module_name} virtual tables\"\n        )\n\n    qualified_name = _qualified_table_name(table_name)\n\n    # Build column definitions for virtual table syntax\n    col_defs = []\n    partition_keys = set(virtual_table_def.partition_key_columns)\n    auxiliary_cols = set(virtual_table_def.auxiliary_columns)\n\n    for col_name, col_def in schema.columns.items():\n        parts = []\n\n        # Add + prefix for auxiliary columns\n        if col_name in auxiliary_cols:\n            parts.append(f\"+{col_name}\")\n        else:\n            parts.append(col_name)","sourceCodeStart":699,"sourceCodeEnd":735,"githubUrl":"https://github.com/cocoindex-io/cocoindex/blob/e84aa99b3292c5270a4b313b2a7137ad9ce8ab3b/python/cocoindex/connectors/sqlite/_target.py#L699-L735","documentation":"Creating a `vec0` virtual table requires the sqlite-vec extension to be loaded into the connection. `_create_virtual_table` checks `has_vec_extension` before issuing `CREATE VIRTUAL TABLE ... USING vec0(...)` and raises `RuntimeError` when the extension is missing, because SQLite cannot parse the `vec0` module without it.","triggerScenarios":"Syncing a table target defined with `Vec0TableDef` (module `vec0`) to a SQLite connection opened without `connect(..., load_vec=True)`, or an environment where the `sqlite-vec` package is not installed so the extension cannot be loaded even when requested.","commonSituations":"Forgetting `load_vec=True` in `connect()` after adding a vector column to a previously plain SQLite table; deploying to a machine where `sqlite-vec` is not in the dependency list; using a system SQLite build that cannot load extensions.","solutions":["Open the connection with `connect(path, load_vec=True)`","Add `sqlite-vec` to your project dependencies so the extension is available to load","Verify the SQLite build supports loading extensions (some system/distro builds disable extension loading)"],"exampleFix":"// before\nconn = sqlite.connect(\"app.db\")\n// after\nconn = sqlite.connect(\"app.db\", load_vec=True)","handlingStrategy":"validation","validationCode":"conn = sqlite.connect(path, load_vec=True)\nassert \"vec0\" in conn.loaded_extensions","typeGuard":null,"tryCatchPattern":"try:\n    await app.update()\nexcept RuntimeError as e:\n    if \"sqlite-vec extension required\" in str(e):\n        # reopen connection with load_vec=True or install sqlite-vec\n        ...\n    else:\n        raise","preventionTips":["Always pass load_vec=True when any table uses Vec0TableDef or vector columns","Add sqlite-vec to project dependencies and CI","Sanity-check extension loading at startup in a smoke test"],"tags":["sqlite","sqlite-vec","vector","extension"],"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"}