diff --git a/src/pq_flash_index.cpp b/src/pq_flash_index.cpp index 179e9a71e..60b212b5f 100644 --- a/src/pq_flash_index.cpp +++ b/src/pq_flash_index.cpp @@ -190,6 +190,16 @@ std::vector PQFlashIndex::read_nodes(const std::vector _max_degree) + { + std::stringstream stream; + stream << "Corrupt or mismatched index data detected: num_nbrs (" << num_nbrs + << ") exceeds max_degree (" << _max_degree << "). " + << "This may indicate a data type mismatch - ensure the data_type parameter " + << "matches the type used when building the index."; + throw diskann::ANNException(stream.str(), -1, __FUNCSIG__, __FILE__, __LINE__); + } nbr_buffers[i].first = num_nbrs; memcpy(nbr_buffers[i].second, node_nhood + 1, num_nbrs * sizeof(uint32_t)); }