{"record":{"id":"68b96db3070be601","repo":"cocoindex-io/cocoindex","slug":"invalid-qdrant-point-id-of-type-type-raw-name","errorCode":null,"errorMessage":"Invalid Qdrant point ID of type {type(raw).__name__}. {_POINT_ID_RULE}","messagePattern":"Invalid Qdrant point ID of type (.+?)\\. (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/cocoindex/connectors/qdrant/_target.py","lineNumber":763,"sourceCode":"    if isinstance(raw, int):\n        if not 0 <= raw < 1 << 64:\n            raise ValueError(\n                f\"Invalid Qdrant point ID {raw!r}: out of unsigned 64-bit range. \"\n                f\"{_POINT_ID_RULE}\"\n            )\n        return raw\n    if isinstance(raw, uuid.UUID):\n        return str(raw)\n    if isinstance(raw, str):\n        try:\n            uuid.UUID(raw)\n        except ValueError:\n            raise ValueError(\n                f\"Invalid Qdrant point ID {raw!r}: strings must be UUIDs. \"\n                f\"{_POINT_ID_RULE}\"\n            ) from None\n        return raw\n    raise ValueError(\n        f\"Invalid Qdrant point ID of type {type(raw).__name__}. {_POINT_ID_RULE}\"\n    )\n\n\n__all__ = [\n    \"CollectionSchema\",\n    \"CollectionTarget\",\n    \"PointStruct\",\n    \"QdrantSparseVectorDef\",\n    \"QdrantVectorDef\",\n    \"collection_target\",\n    \"create_client\",\n    \"declare_collection_target\",\n    \"mount_collection_target\",\n]\n","sourceCodeStart":745,"sourceCodeEnd":779,"githubUrl":"https://github.com/cocoindex-io/cocoindex/blob/e84aa99b3292c5270a4b313b2a7137ad9ce8ab3b/python/cocoindex/connectors/qdrant/_target.py#L745-L779","documentation":"After checking int and UUID/str cases, _validate_point_id rejects any other type with this ValueError naming the offending type, plus the point-ID rule. Qdrant only supports unsigned 64-bit ints and UUIDs (str or uuid.UUID) as point IDs, so bytes, lists, dicts, None, etc. are rejected at declare time.","triggerScenarios":"Calling declare_point with id=None, bytes, a tuple, a list, or any non-int/str/UUID object; commonly from passing a dictionary key object or forgetting to extract the string/ID field from a wrapper.","commonSituations":"Passing a FileLike/key object instead of its ID string; None from an optional field defaulting to None; bytes from a hash function.","solutions":["Extract the actual ID value before declaring: use the str key or int ID, not the containing object.","For bytes from a hash, convert: str(uuid.UUID(bytes= digest)) or format as a UUID string.","Replace None with a real ID — generate one via uuid.uuid4()/uuid5.","Add an isinstance check (int | str | uuid.UUID) before calling declare_point."],"exampleFix":"// before\nawait target.declare_point(id=some_file_like, ...)\n// after\nawait target.declare_point(id=str(uuid.uuid5(uuid.NAMESPACE_URL, some_file_like.file_path.path.as_posix())), ...)","handlingStrategy":"type-guard","validationCode":"def _valid_point_id(raw):\n    import uuid\n    return (isinstance(raw, int) and 0 <= raw < (1 << 64)) or is_uuid_string(raw) or isinstance(raw, uuid.UUID)","typeGuard":"def is_valid_point_id(raw) -> bool:\n    import uuid\n    if isinstance(raw, uuid.UUID): return True\n    if isinstance(raw, str):\n        try: uuid.UUID(raw); return True\n        except ValueError: return False\n    return isinstance(raw, int) and 0 <= raw < (1 << 64)","tryCatchPattern":"try:\n    await target.declare_point(id=pid, ...)\nexcept ValueError as e:\n    log.error(\"point id has unsupported type %s\", type(pid).__name__)\n    raise","preventionTips":["Unwrap objects before declaring — pass the ID string/int, not the containing object.","Ensure optional ID fields have real defaults, not None.","Centralize point-ID creation in one helper that always returns int|str|UUID."],"tags":["qdrant","point-id","type-error"],"backgroundTag":"invalid-argument-value","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"}