FlowiseAI/Flowise · error · Error

Error checking collection: ${hasColResp}

Error message

Error checking collection: ${hasColResp}

What it means

Thrown by the Milvus similaritySearchVectorWithScore helper when hasCollection's response status.error_code is not SUCCESS. This indicates a client/server RPC error checking collection existence, not merely a missing collection (that case is error 518).

Source

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

        return vectorStore
    }
}

const checkJsonString = (value: string): { isJson: boolean; obj: any } => {
    try {
        const result = JSON.parse(value)
        return { isJson: true, obj: result }
    } catch (e) {
        return { isJson: false, obj: null }
    }
}

const similaritySearchVectorWithScore = async (query: number[], k: number, vectorStore: Milvus, milvusFilter?: string, filter?: string) => {
    const hasColResp = await vectorStore.client.hasCollection({
        collection_name: vectorStore.collectionName
    })
    if (hasColResp.status.error_code !== ErrorCode.SUCCESS) {
        throw new Error(`Error checking collection: ${hasColResp}`)
    }
    if (hasColResp.value === false) {
        throw new Error(`Collection not found: ${vectorStore.collectionName}, please create collection before search.`)
    }

    const filterStr = milvusFilter ?? filter ?? ''

    await vectorStore.grabCollectionFields()

    const loadResp = await vectorStore.client.loadCollectionSync({
        collection_name: vectorStore.collectionName
    })

    if (loadResp.error_code !== ErrorCode.SUCCESS) {
        throw new Error(`Error loading collection: ${loadResp}`)
    }

    const outputFields = vectorStore.fields.filter((field) => field !== vectorStore.vectorField)

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Inspect hasColResp.status for the specific error_code and reason.
  2. Verify the collection_name is valid and matches the indexed collection.
  3. Confirm Milvus server health and auth.
  4. Retry transient RPC errors after a short backoff.

Example fix

// before
if (hasColResp.status.error_code !== ErrorCode.SUCCESS) {
    throw new Error(`Error checking collection: ${hasColResp}`)
}

// after
if (hasColResp.status.error_code !== ErrorCode.SUCCESS) {
    throw new Error(`Error checking collection ${vectorStore.collectionName}: ${hasColResp.status.error_code} - ${hasColResp.status.reason}`, { cause: hasColResp })
}
Defensive patterns

Strategy: retry

Validate before calling

const health = await vectorStore.client.checkHealth()
if (!health.isHealthy) throw new Error(`Milvus unhealthy: ${JSON.stringify(health)}`)
// validate collection name format
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(vectorStore.collectionName)) {
  throw new Error('Invalid collection name')
}

Type guard

function isMilvusRpcError(e: unknown): e is { code: number; message: string } {
  return typeof e === 'object' && e !== null && typeof (e as any).code === 'number'
}

Try / catch

let hasColResp
for (let i = 0; i < 3; i++) {
  try { hasColResp = await vectorStore.client.hasCollection({ collection_name: vectorStore.collectionName }); break }
  catch (e) { if (i < 2) { await backoff(i); continue } throw e }
}
if (hasColResp.status.error_code !== ErrorCode.SUCCESS) throw new Error(`Error checking collection: ${hasColResp.status.reason}`)

Prevention

When it happens

Trigger: Search path calls vectorStore.client.hasCollection({collection_name}); the SDK returns a non-SUCCESS error_code (e.g. collection name invalid, server-side error, rate limit, auth failure).

Common situations: Milvus server temporarily unavailable during search, collection name contains invalid characters, auth token expired, or server version returns unexpected error codes.

Related errors


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