{"record":{"id":"7ddb6af953bcf367","repo":"FlowiseAI/Flowise","slug":"collection-not-found-vectorstore-collectionname","errorCode":null,"errorMessage":"Collection not found: ${vectorStore.collectionName}, please create collection before search.","messagePattern":"Collection not found: (.+?), please create collection before search\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/vectorstores/Milvus/Milvus.ts","lineNumber":347,"sourceCode":"\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)\n\n    const search_params: any = {\n        anns_field: vectorStore.vectorField,","sourceCodeStart":329,"sourceCodeEnd":365,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/vectorstores/Milvus/Milvus.ts#L329-L365","documentation":"Thrown when hasCollection returns SUCCESS but value === false — the collection genuinely does not exist on the Milvus server. The helper refuses to search a non-existent collection.","triggerScenarios":"Search or retrieve on a collection name that was never created, was dropped, or belongs to a different database/namespace than the client is connected to.","commonSituations":"Collection not yet created (forgot the create step), dropped during maintenance, typo in collection name, or wrong database selected on the client.","solutions":["Create the collection and build its index before searching.","Run at least one upsert first so the collection is initialized.","Double-check the collection_name spelling and the database context.","Guard the search with a hasCollection check that auto-creates or returns empty results."],"exampleFix":"// before\n// searching before any upsert -> Collection not found\nawait similaritySearchVectorWithScore(query, k, vectorStore)\n\n// after\nconst exists = (await vectorStore.client.hasCollection({ collection_name: vectorStore.collectionName })).value\nif (!exists) {\n    // create + upsert first, or return [] gracefully\n    return []\n}\nawait similaritySearchVectorWithScore(query, k, vectorStore)","handlingStrategy":"validation","validationCode":"const exists = await vectorStore.client.hasCollection({ collection_name: vectorStore.collectionName })\nif (exists.status.error_code === ErrorCode.SUCCESS && exists.value === false) {\n  throw new Error(`Collection ${vectorStore.collectionName} does not exist; create it or upsert first`)\n}","typeGuard":"async function collectionExists(client: MilvusClient, name: string): Promise<boolean> {\n  const r = await client.hasCollection({ collection_name: name })\n  return r.status.error_code === ErrorCode.SUCCESS && r.value === true\n}","tryCatchPattern":"if (!(await collectionExists(vectorStore.client, vectorStore.collectionName))) {\n  // either create+index, or return empty gracefully\n  return []\n}\nawait similaritySearchVectorWithScore(query, k, vectorStore)","preventionTips":["Always create the collection and build its index before exposing search.","Run an upsert as a smoke test during provisioning.","Guard search entry with a hasCollection check."],"tags":["milvus","collection","missing","search"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}