ruvnet/ruflo · error
Unsupported index type: ${options.indexType}
Error message
Unsupported index type: ${options.indexType} What it means
Thrown by createIndex() when options.indexType is not a key of INDEX_TYPE_SQL. Supported types are 'hnsw', 'ivfflat', 'ivfpq', 'flat', and 'diskann' (the last two being special-cased: flat skips index creation, diskann falls back to HNSW). Any other string yields undefined in the lookup and is rejected as unsupported.
Source
Thrown at v3/@claude-flow/plugins/src/integrations/ruvector/ruvector-bridge.ts:864
const durationMs = Date.now() - startTime;
const deleted = result.affectedRows ?? 0;
return {
total: ids.length,
successful: deleted,
failed: ids.length - deleted,
durationMs,
throughput: deleted / (durationMs / 1000),
};
}
/**
* Create a vector index.
*/
async createIndex(options: VectorIndexOptions): Promise<void> {
const indexType = INDEX_TYPE_SQL[options.indexType];
if (!indexType && options.indexType !== 'flat') {
throw new Error(`Unsupported index type: ${options.indexType}`);
}
const indexName = options.indexName ??
`idx_${options.tableName}_${options.columnName}_${options.indexType}`;
const schemaPrefix = this.config.schema ? `${this.escapeIdentifier(this.config.schema)}.` : '';
if (options.replace) {
await this.connectionManager.query(
`DROP INDEX IF EXISTS ${schemaPrefix}${this.escapeIdentifier(indexName)}`
);
}
if (options.indexType === 'flat') {
return; // No index needed for brute force
}
// Build operator class based on metric
const opClass = this.getOperatorClass(options.metric ?? 'cosine', options.indexType);View on GitHub (pinned to fa13ee4ad6)
Solutions
- Use one of: 'hnsw', 'ivfflat', 'ivfpq', 'flat', 'diskann' (lowercase)
- Type the field as the library's VectorIndexType union so invalid literals fail at compile time
- Validate/normalize config-sourced values (trim + lowercase + allowlist) before calling createIndex
Example fix
// before
await bridge.createIndex({ tableName: 'vectors', columnName: 'embedding', indexType: 'HNSW' }); // throws
// after
await bridge.createIndex({ tableName: 'vectors', columnName: 'embedding', indexType: 'hnsw' }); Defensive patterns
Strategy: type-guard
Validate before calling
const INDEX_TYPES = ['hnsw', 'ivfflat', 'ivfpq', 'flat', 'diskann'] as const;
const indexType = String(cfg.indexType).trim().toLowerCase() as (typeof INDEX_TYPES)[number];
if (!INDEX_TYPES.includes(indexType)) {
throw new Error(`indexType must be one of: ${INDEX_TYPES.join(', ')}`);
}
await bridge.createIndex({ tableName, columnName, indexType }); Type guard
const isVectorIndexType = (t: unknown): t is 'hnsw' | 'ivfflat' | 'ivfpq' | 'flat' | 'diskann' => typeof t === 'string' && ['hnsw', 'ivfflat', 'ivfpq', 'flat', 'diskann'].includes(t);
Try / catch
try {
await bridge.createIndex(opts);
} catch (err) {
if (err instanceof Error && err.message.startsWith('Unsupported index type')) {
throw new ConfigurationError(`${opts.indexType} is not a pgvector index type this bridge supports`);
}
throw err;
} Prevention
- Type index config as the library's VectorIndexType union instead of string
- Validate config-sourced indexType against the allowlist before calling createIndex
- Remember 'flat' (no index) and 'diskann' (HNSW fallback) are legal but behave specially
When it happens
Trigger: Passing 'ivf', 'lsh', 'HNSW' (wrong case), or a value read straight from user config into createIndex(); forwarding an indexType meant for a different vector DB (e.g. pgvector syntax like 'hnsw_cosine') verbatim.
Common situations: Porting configs from another vector store whose type names differ; config fields typed as plain string instead of the VectorIndexType union; casing drift after a config refactor.
Related errors
- Index ${indexName} not found
- File not found
- Invalid embedding value at index ${i}: expected finite numbe
- Schema name must not be empty
- Schema name too long (${schema.length} chars, max 63): "${sc
AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18).
Data as JSON: /api/errors/2f797ee49c7da341.
Report an issue: GitHub.