FlowiseAI/Flowise · error · Error

Error creating index

Error message

Error creating index

What it means

Thrown when the Milvus SDK's `createIndex` call returns an `error_code` other than `SUCCESS`. This branch only runs when `describeIndex` reported `IndexNotExist`, i.e. the code is attempting to lazily create an index on the vector field before insert. The index is created with `AUTOINDEX` and `MetricType.L2`.

Source

Thrown at packages/components/nodes/vectorstores/Milvus/Milvus.ts:477

            })

            insertDatas.push(data)
        }

        const descIndexResp = await this.client.describeIndex({
            collection_name: this.collectionName
        })

        if (descIndexResp.status.error_code === ErrorCode.IndexNotExist) {
            const resp = await this.client.createIndex({
                collection_name: this.collectionName,
                field_name: this.vectorField,
                index_name: `myindex_${Date.now().toString()}`,
                index_type: IndexType.AUTOINDEX,
                metric_type: MetricType.L2
            })
            if (resp.error_code !== ErrorCode.SUCCESS) {
                throw new Error(`Error creating index`)
            }
        }

        const insertResp = await this.client.insert({
            collection_name: this.collectionName,
            fields_data: insertDatas
        })

        if (insertResp.status.error_code !== ErrorCode.SUCCESS) {
            throw new Error(`Error inserting data: ${JSON.stringify(insertResp)}`)
        }

        await this.client.flushSync({ collection_names: [this.collectionName] })
    }
}

module.exports = { nodeClass: Milvus_VectorStores }

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Check the Milvus server logs for the createIndex failure reason (the node discards it — only 'Error creating index' is surfaced).
  2. Pre-create the index manually with `client.createIndex(...)` using an explicit index type supported by your Milvus edition (e.g. IVF_FLAT, HNSW).
  3. Verify the user/token has index-admin privileges on the collection.
  4. Confirm the vector field name passed to `field_name` matches the collection schema exactly.
  5. Upgrade Milvus to a version that supports AUTOINDEX if using a managed offering that requires it.

Example fix

// before — opaque failure
if (resp.error_code !== ErrorCode.SUCCESS) {
    throw new Error(`Error creating index`)
}
// after — include the server reason
if (resp.error_code !== ErrorCode.SUCCESS) {
    throw new Error(`Error creating index: ${JSON.stringify(resp)}`)
}
Defensive patterns

Strategy: try-catch

Validate before calling

// preflight: check supported index capability
const info = await this.client.getCollectionInfo({ collection_name: this.collectionName })
if (!info) throw new Error('Collection does not exist; create it before insert')

Type guard

function isCreateIndexSuccess(resp: any): boolean {
  return resp?.error_code === 0 || resp?.error_code === 'Success'
}

Try / catch

try {
  const resp = await this.client.createIndex({ /* ... */ })
  if (!isCreateIndexSuccess(resp)) throw new Error(`createIndex failed: ${JSON.stringify(resp)}`)
} catch (e) {
  throw e instanceof Error ? e : new Error(String(e))
}

Prevention

When it happens

Trigger: First insert into a collection that has no index yet, where `createIndex` fails — common causes: insufficient permissions, an unsupported `field_name`, a server that disables AUTOINDEX, or a collection still in a creating/loading state. Also fires on zilliz cloud tiers with index restrictions.

Common situations: New collection never indexed; permissions grant read/write but not index-admin; vector field name in the node config does not match the schema; Milvus server version does not support AUTOINDEX (older than 2.1.0).

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/30d871c1b938a40e. Report an issue: GitHub.