{"record":{"id":"83c63768ac80a86a","repo":"FlowiseAI/Flowise","slug":"error-checking-collection-hascolresp","errorCode":null,"errorMessage":"Error checking collection: ${hasColResp}","messagePattern":"Error checking collection: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/vectorstores/Milvus/Milvus.ts","lineNumber":344,"sourceCode":"        return vectorStore\n    }\n}\n\nconst checkJsonString = (value: string): { isJson: boolean; obj: any } => {\n    try {\n        const result = JSON.parse(value)\n        return { isJson: true, obj: result }\n    } catch (e) {\n        return { isJson: false, obj: null }\n    }\n}\n\nconst similaritySearchVectorWithScore = async (query: number[], k: number, vectorStore: Milvus, milvusFilter?: string, filter?: string) => {\n    const hasColResp = await vectorStore.client.hasCollection({\n        collection_name: vectorStore.collectionName\n    })\n    if (hasColResp.status.error_code !== ErrorCode.SUCCESS) {\n        throw new Error(`Error checking collection: ${hasColResp}`)\n    }\n    if (hasColResp.value === false) {\n        throw new Error(`Collection not found: ${vectorStore.collectionName}, please create collection before search.`)\n    }\n\n    const filterStr = milvusFilter ?? filter ?? ''\n\n    await vectorStore.grabCollectionFields()\n\n    const loadResp = await vectorStore.client.loadCollectionSync({\n        collection_name: vectorStore.collectionName\n    })\n\n    if (loadResp.error_code !== ErrorCode.SUCCESS) {\n        throw new Error(`Error loading collection: ${loadResp}`)\n    }\n\n    const outputFields = vectorStore.fields.filter((field) => field !== vectorStore.vectorField)","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/vectorstores/Milvus/Milvus.ts#L326-L362","documentation":"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).","triggerScenarios":"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).","commonSituations":"Milvus server temporarily unavailable during search, collection name contains invalid characters, auth token expired, or server version returns unexpected error codes.","solutions":["Inspect hasColResp.status for the specific error_code and reason.","Verify the collection_name is valid and matches the indexed collection.","Confirm Milvus server health and auth.","Retry transient RPC errors after a short backoff."],"exampleFix":"// before\nif (hasColResp.status.error_code !== ErrorCode.SUCCESS) {\n    throw new Error(`Error checking collection: ${hasColResp}`)\n}\n\n// after\nif (hasColResp.status.error_code !== ErrorCode.SUCCESS) {\n    throw new Error(`Error checking collection ${vectorStore.collectionName}: ${hasColResp.status.error_code} - ${hasColResp.status.reason}`, { cause: hasColResp })\n}","handlingStrategy":"retry","validationCode":"const health = await vectorStore.client.checkHealth()\nif (!health.isHealthy) throw new Error(`Milvus unhealthy: ${JSON.stringify(health)}`)\n// validate collection name format\nif (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(vectorStore.collectionName)) {\n  throw new Error('Invalid collection name')\n}","typeGuard":"function isMilvusRpcError(e: unknown): e is { code: number; message: string } {\n  return typeof e === 'object' && e !== null && typeof (e as any).code === 'number'\n}","tryCatchPattern":"let hasColResp\nfor (let i = 0; i < 3; i++) {\n  try { hasColResp = await vectorStore.client.hasCollection({ collection_name: vectorStore.collectionName }); break }\n  catch (e) { if (i < 2) { await backoff(i); continue } throw e }\n}\nif (hasColResp.status.error_code !== ErrorCode.SUCCESS) throw new Error(`Error checking collection: ${hasColResp.status.reason}`)","preventionTips":["Health-check Milvus before searching.","Use valid collection names matching the Milvus naming rules.","Retry transient RPC errors with backoff."],"tags":["milvus","collection","rpc","search"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}