{"record":{"id":"82abfcceb8b50535","repo":"cocoindex-io/cocoindex","slug":"build-relationship-index-drop-requires-at-least-on","errorCode":null,"errorMessage":"build_relationship_index_drop requires at least one field","messagePattern":"build_relationship_index_drop requires at least one field","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"python/cocoindex/connectors/falkordb/_cypher.py","lineNumber":169,"sourceCode":"    \"\"\"``DROP INDEX FOR (e:`Label`) ON (e.`f1`, ...)``.\"\"\"\n    if not fields:\n        raise ValueError(\"build_node_index_drop requires at least one field\")\n    field_list = \", \".join(f\"e.{_quote(f)}\" for f in fields)\n    return f\"DROP INDEX FOR (e:{_quote(label)}) ON ({field_list})\"\n\n\ndef build_relationship_index_create(rel_type: str, fields: Sequence[str]) -> str:\n    \"\"\"``CREATE INDEX FOR ()-[e:`RelType`]-() ON (e.`f1`, ...)``.\"\"\"\n    if not fields:\n        raise ValueError(\"build_relationship_index_create requires at least one field\")\n    field_list = \", \".join(f\"e.{_quote(f)}\" for f in fields)\n    return f\"CREATE INDEX FOR ()-[e:{_quote(rel_type)}]-() ON ({field_list})\"\n\n\ndef build_relationship_index_drop(rel_type: str, fields: Sequence[str]) -> str:\n    \"\"\"``DROP INDEX FOR ()-[e:`RelType`]-() ON (e.`f1`, ...)``.\"\"\"\n    if not fields:\n        raise ValueError(\"build_relationship_index_drop requires at least one field\")\n    field_list = \", \".join(f\"e.{_quote(f)}\" for f in fields)\n    return f\"DROP INDEX FOR ()-[e:{_quote(rel_type)}]-() ON ({field_list})\"\n\n\ndef build_vector_index_create(\n    label: str,\n    field: str,\n    dimension: int,\n    metric: str,\n) -> str:\n    \"\"\"``CREATE VECTOR INDEX FOR (e:`Label`) ON (e.`field`) OPTIONS {...}``.\n\n    ``metric`` is the FalkorDB-side ``similarityFunction`` value\n    (e.g. ``\"cosine\"``, ``\"euclidean\"``). Caller is responsible for translating\n    user-facing names into the FalkorDB vocabulary before invoking.\n    \"\"\"\n    if dimension <= 0:\n        raise ValueError(f\"Invalid vector dimension: {dimension}\")","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/cocoindex-io/cocoindex/blob/e84aa99b3292c5270a4b313b2a7137ad9ce8ab3b/python/cocoindex/connectors/falkordb/_cypher.py#L151-L187","documentation":"Input guard in the FalkorDB Cypher builder mirroring its create counterpart: DROP INDEX requires at least one indexed property, and an empty fields list would yield invalid Cypher. Fired when the connector tears down or rebuilds a relationship index but the stored/declared field list is empty. Provide at least one field when declaring the relationship index.","triggerScenarios":"Calling build_relationship_index_drop(rel_type, fields=[]) — dropping a relationship index whose field list is empty or lost.","commonSituations":"Teardown/cleanup passing empty fields; index metadata not persisted so the drop spec is empty; mismatch between create and drop field lists.","solutions":["Pass exactly the fields the relationship index was created with.","Guard the drop call: only issue it when recorded fields are non-empty.","Fix the metadata source so relationship index fields survive across runs."],"exampleFix":"// before\nbuild_relationship_index_drop(rel_type=\"WORKS_AT\", fields=[])\n// after\nbuild_relationship_index_drop(rel_type=\"WORKS_AT\", fields=[\"since\"])","handlingStrategy":"validation","validationCode":"if fields:\n    cypher = build_relationship_index_drop(rel_type, fields)\n# else: nothing to drop","typeGuard":"def droppable(fields: object) -> bool:\n    return isinstance(fields, (list, tuple)) and len(fields) > 0","tryCatchPattern":"try:\n    cypher = build_relationship_index_drop(rel_type, fields)\nexcept ValueError as e:\n    logger.warning('no fields recorded for relationship index %s; skipping drop: %s', rel_type, e)\n    cypher = None","preventionTips":["Store relationship index fields with the index spec and reuse them for drops.","Skip drop calls when no fields are recorded instead of passing an empty list.","Keep create and drop field lists derived from the same source of truth."],"tags":["cypher","falkordb","index","relationship"],"backgroundTag":"missing-required-argument","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"}