{"record":{"id":"3912ef42a7886f30","repo":"FlowiseAI/Flowise","slug":"error-loading-collection-loadresp","errorCode":null,"errorMessage":"Error loading collection: ${loadResp}","messagePattern":"Error loading collection: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/vectorstores/Milvus/Milvus.ts","lineNumber":359,"sourceCode":"        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)\n\n    const search_params: any = {\n        anns_field: vectorStore.vectorField,\n        topk: k.toString(),\n        metric_type: vectorStore.indexCreateParams.metric_type,\n        params: JSON.stringify(vectorStore.indexSearchParams)\n    }\n    const searchResp = await vectorStore.client.search({\n        collection_name: vectorStore.collectionName,\n        search_params,\n        output_fields: outputFields,\n        vector_type: DataType.FloatVector,\n        vectors: [query],\n        filter: filterStr\n    })","sourceCodeStart":341,"sourceCodeEnd":377,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/vectorstores/Milvus/Milvus.ts#L341-L377","documentation":"After confirming the collection exists, the helper calls loadCollectionSync; if the response error_code is not SUCCESS, this error is thrown. Loading pulls the collection's data into memory for searching — it can fail on memory limits, schema issues, or server state.","triggerScenarios":"Search path: collection exists, grabCollectionFields succeeds, then loadCollectionSync returns a non-SUCCESS error_code. Happens when the collection has no index, insufficient memory, or is in a bad state.","commonSituations":"Vector index not built before load, collection too large for query-node memory, concurrent load/unload races, or schema/index build still in progress.","solutions":["Ensure a vector index is created on the collection before loading.","Check Milvus query-node memory; scale up if collection exceeds available memory.","Wait for any in-progress index build to finish before searching.","Inspect loadResp.error_code/reason and address the specific failure."],"exampleFix":"// before\nif (loadResp.error_code !== ErrorCode.SUCCESS) {\n    throw new Error(`Error loading collection: ${loadResp}`)\n}\n\n// after\nif (loadResp.error_code !== ErrorCode.SUCCESS) {\n    throw new Error(`Error loading collection ${vectorStore.collectionName}: ${loadResp.error_code} - ${loadResp.reason}`, { cause: loadResp })\n}","handlingStrategy":"validation","validationCode":"const loaded = await vectorStore.client.getLoadState({ collection_name: vectorStore.collectionName })\nif (loaded.state !== LoadState.LoadStateLoaded) {\n  // ensure index exists before loading\n  const idxInfo = await vectorStore.client.describeIndex({ collection_name: vectorStore.collectionName, field_name: vectorStore.vectorField })\n  if (!idxInfo.index_descriptions?.length) throw new Error('Build a vector index before load')\n}","typeGuard":"function isLoadFailure(r: unknown): r is { error_code: string | number; reason?: string } {\n  return typeof r === 'object' && r !== null && (r as any).error_code !== undefined && (r as any).error_code !== ErrorCode.SUCCESS\n}","tryCatchPattern":"try {\n  await vectorStore.client.loadCollectionSync({ collection_name: vectorStore.collectionName })\n} catch (e) {\n  if (/memory|resource/i.test(String(e))) {\n    throw new Error('Insufficient memory to load collection — scale Milvus query nodes', { cause: e })\n  }\n  throw e\n}","preventionTips":["Always build a vector index before loading a collection.","Size query-node memory to exceed the collection's footprint.","Wait for in-progress index builds to finish before searching."],"tags":["milvus","collection","load","memory"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}