Mintplex-Labs/anything-llm · error · Error

Failed to create new AstraDB collection!

Error message

Failed to create new AstraDB collection!

What it means

In AstraDB's addDocumentToNamespace cached-vector path, after getOrCreateCollection() succeeds the result is validated with isRealCollection(); if that check fails, the provider throws 'Failed to create new AstraDB collection!' with the namespace attached as error metadata. It means the client returned something that is not a usable collection object (or creation silently no-oped) even though no exception was raised.

Source

Thrown at server/utils/vectorDbProviders/astra/index.js:184

      const { pageContent, docId, ...metadata } = documentData;
      if (!pageContent || pageContent.length == 0) return false;

      this.logger("Adding new vectorized document into namespace", namespace);
      if (!skipCache) {
        const cacheResult = await cachedVectorInformation(fullFilePath);
        if (cacheResult.exists) {
          const { client } = await this.connect();
          const { chunks } = cacheResult;
          const documentVectors = [];
          vectorDimension = chunks[0][0].values.length || null;

          const collection = await this.getOrCreateCollection(
            client,
            namespace,
            vectorDimension
          );
          if (!(await this.isRealCollection(collection)))
            throw new Error("Failed to create new AstraDB collection!", {
              namespace,
            });

          for (const chunk of chunks) {
            // Before sending to Astra and saving the records to our db
            // we need to assign the id of each chunk that is stored in the cached file.
            const newChunks = chunk.map((chunk) => {
              const _id = uuidv4();
              documentVectors.push({ docId, vectorId: _id });
              return {
                _id: _id,
                $vector: chunk.values,
                metadata: chunk.metadata || {},
              };
            });

            await collection.insertMany(newChunks);
          }

View on GitHub (pinned to 3aec848f28)

Solutions

  1. Retry the embed/document operation once - propagation lag on newly created collections is the most common cause.
  2. Verify the ASTRA_DB_API_ENDPOINT and ASTRA_DB_APPLICATION_TOKEN are valid and the database is active (not paused) in the Astra console.
  3. Check the namespace exists in the Astra dashboard; if its dimension mismatches the current embedder, delete it so it is recreated with the right dimension.
  4. Inspect the full error's attached { namespace } and server logs to confirm which collection failed.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await vectorDb.addDocumentToNamespace(namespace, buffer, filePath, metadata);
} catch (e) {
  if (/Failed to create new AstraDB collection/i.test(e.message)) {
    await sleep(5000);            // Astra serverless propagation lag
    return vectorDb.addDocumentToNamespace(namespace, buffer, filePath, metadata);
  }
  throw e;
}

Prevention

When it happens

Trigger: Re-embedding a document from vector cache into a namespace whose collection was deleted or is still propagating on Astra's side, or an Astra DB API response shape the code does not recognize (undefined/null collection).

Common situations: Collection dropped in the Astra dashboard between runs; serverless Astra occasionally consistent reads right after createCollection; expired/rotated token causing the SDK to return an error object instead of throwing.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18). Data as JSON: /api/errors/39142bef9633dadb. Report an issue: GitHub.