{"record":{"id":"1c7816055646dd14","repo":"cocoindex-io/cocoindex","slug":"zvec-operation-failed-code-status-code-messag","errorCode":null,"errorMessage":"zvec operation failed: code={status.code()} message={status.message()}","messagePattern":"zvec operation failed: code=(.+?) message=(.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"python/cocoindex/connectors/zvec/_target.py","lineNumber":608,"sourceCode":"\n\nclass _DocValue(NamedTuple):\n    doc_id: str\n    vectors: dict[str, Any]\n    fields: dict[str, Any]\n\n\nclass _DocAction(NamedTuple):\n    doc_id: _DocId\n    value: _DocValue | None  # None means delete\n\n\ndef _check_status(result: Any) -> None:\n    \"\"\"Raise if any zvec Status in the result is not OK.\"\"\"\n    statuses = result if isinstance(result, list) else [result]\n    for status in statuses:\n        if not status.ok():\n            raise RuntimeError(\n                f\"zvec operation failed: code={status.code()} \"\n                f\"message={status.message()}\"\n            )\n\n\ndef _build_doc(value: _DocValue) -> Any:\n    vectors = {k: v for k, v in value.vectors.items() if v is not None}\n    fields = {k: v for k, v in value.fields.items() if v is not None}\n    return _zvec.Doc(\n        id=value.doc_id,\n        vectors=vectors or None,\n        fields=fields or None,\n    )\n\n\nclass _DocHandler(coco.TargetHandler[_DocValue, bytes]):\n    \"\"\"Handler for document-level target states within a collection.\"\"\"\n","sourceCodeStart":590,"sourceCodeEnd":626,"githubUrl":"https://github.com/cocoindex-io/cocoindex/blob/e84aa99b3292c5270a4b313b2a7137ad9ce8ab3b/python/cocoindex/connectors/zvec/_target.py#L590-L626","documentation":"_check_status inspects the Status object(s) returned by zvec operations and raises RuntimeError if any status is not OK. This surfaces a failed write/upsert/delete inside the zvec engine with its native code and message.","triggerScenarios":"Calling _apply_actions (syncing declared rows to the zvec collection) when the underlying zvec write returns a non-OK Status, e.g. corrupted segment, disk full, or an engine-level write error.","commonSituations":"Disk exhaustion or I/O errors on the local vector store path; corrupted collection files; resource limits inside the zvec engine during bulk upserts.","solutions":["Read the embedded zvec code/message to identify the engine-level failure.","Check free disk space and filesystem health on the collection's storage path.","Retry the update; if the collection is corrupted, rebuild it (drop and re-declare the target state)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    await app.update()\nexcept RuntimeError as e:\n    if str(e).startswith(\"zvec operation failed\"):\n        code, msg = e.args[0].split(\"message=\")\n        logging.critical(\"zvec write failed: %s\", msg)\n        # inspect disk space / collection health, then retry or rebuild","preventionTips":["Monitor disk space on the zvec storage path.","Retry failed updates; rebuild the collection if corruption persists.","Keep zvec library versions in sync with files written by older versions."],"tags":["python","vector-database","runtime-error","write-failed"],"backgroundTag":"database-write-failed","analyzedSha":"e84aa99b3292c5270a4b313b2a7137ad9ce8ab3b","analyzedAt":"2026-09-08T15:59:19.997Z","contentChangedAt":"2026-09-08T15:59:19.997Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}