FlowiseAI/Flowise · error · Error
Error inserting data: ${JSON.stringify(insertResp)}
Error message
Error inserting data: ${JSON.stringify(insertResp)} What it means
Thrown after `client.insert()` when the returned `insertResp.status.error_code` is not `SUCCESS`. The full insert response is JSON-stringified into the message, carrying the server-side reason (dimension mismatch, duplicate primary key, type coercion failure, etc.). This is the terminal insert failure for the Milvus upsert node.
Source
Thrown at packages/components/nodes/vectorstores/Milvus/Milvus.ts:487
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
- Read `insertResp.status.reason` in the JSON payload to identify the precise server error.
- Confirm every vector's dimension matches the collection's vector field dimension.
- Ensure primary-key values are unique across the batch (or use upsert semantics).
- Verify scalar field value types conform to the schema (cast/serialize before insert).
- Reduce batch size if the error mentions row/segment limits.
Example fix
// before
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)}`)
}
// after — also log the offending rows for debugging
if (insertResp.status.error_code !== ErrorCode.SUCCESS) {
console.error('Failed rows:', JSON.stringify(insertDatas).slice(0, 2000))
throw new Error(`Error inserting data (reason=${insertResp.status.reason}): ${JSON.stringify(insertResp)}`)
} Defensive patterns
Strategy: validation
Validate before calling
function validateInsertRows(rows: InsertRow[], vectorDim: number, primaryField: string, autoId: boolean) {
rows.forEach((r, i) => {
const v = r[Object.keys(r).find(k => Array.isArray(r[k])) as string]
if (Array.isArray(v) && v.length !== vectorDim) throw new Error(`Row ${i} vector dim ${v.length} != ${vectorDim}`)
if (!autoId && r[primaryField] === undefined) throw new Error(`Row ${i} missing primary key '${primaryField}'`)
})
} Type guard
function isInsertSuccess(resp: any): boolean {
return resp?.status?.error_code === 0 || resp?.status?.error_code === 'Success'
} Try / catch
try {
const insertResp = await this.client.insert({ collection_name: this.collectionName, fields_data: insertDatas })
if (!isInsertSuccess(insertResp)) throw new Error(`insert failed: ${insertResp.status.reason}`)
} catch (e) {
throw e instanceof Error ? e : new Error(`Milvus insert error: ${String(e)}`)
} Prevention
- Verify vector dimensions match the schema before every batch.
- Ensure primary keys are unique when not using upsert semantics.
- Cast scalar values to their schema types before insert.
- Reduce batch size on row/segment limit errors.
When it happens
Trigger: Inserting rows whose vector length differs from the schema; primary key already exists when not using upsert semantics; a scalar field's value type does not match the schema (e.g. string into an int64 column); collection not loaded; row count exceeds a segment limit.
Common situations: Embedding model changed (dimension mismatch); data type drift after a schema migration; duplicate IDs from a re-run without upsert; very large batch exceeding Milvus insert limits.
Related errors
- Error inserting: ${chunk[0].pageContent}
- Error searching data: ${JSON.stringify(searchResp)}
- Error creating index
- Failed to fetch ${url} from Airtable: ${error}
- ${e}
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/584cbce6d9694b78.
Report an issue: GitHub.