FlowiseAI/Flowise · error · Error

Collection not found: ${vectorStore.collectionName}, please

Error message

Collection not found: ${vectorStore.collectionName}, please create collection before search.

What it means

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.

Source

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

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)

    const search_params: any = {
        anns_field: vectorStore.vectorField,

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Create the collection and build its index before searching.
  2. Run at least one upsert first so the collection is initialized.
  3. Double-check the collection_name spelling and the database context.
  4. Guard the search with a hasCollection check that auto-creates or returns empty results.

Example fix

// before
// searching before any upsert -> Collection not found
await similaritySearchVectorWithScore(query, k, vectorStore)

// after
const exists = (await vectorStore.client.hasCollection({ collection_name: vectorStore.collectionName })).value
if (!exists) {
    // create + upsert first, or return [] gracefully
    return []
}
await similaritySearchVectorWithScore(query, k, vectorStore)
Defensive patterns

Strategy: validation

Validate before calling

const exists = await vectorStore.client.hasCollection({ collection_name: vectorStore.collectionName })
if (exists.status.error_code === ErrorCode.SUCCESS && exists.value === false) {
  throw new Error(`Collection ${vectorStore.collectionName} does not exist; create it or upsert first`)
}

Type guard

async function collectionExists(client: MilvusClient, name: string): Promise<boolean> {
  const r = await client.hasCollection({ collection_name: name })
  return r.status.error_code === ErrorCode.SUCCESS && r.value === true
}

Try / catch

if (!(await collectionExists(vectorStore.client, vectorStore.collectionName))) {
  // either create+index, or return empty gracefully
  return []
}
await similaritySearchVectorWithScore(query, k, vectorStore)

Prevention

When it happens

Trigger: 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.

Common situations: Collection not yet created (forgot the create step), dropped during maintenance, typo in collection name, or wrong database selected on the client.

Related errors


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