{"record":{"id":"39142bef9633dadb","repo":"Mintplex-Labs/anything-llm","slug":"failed-to-create-new-astradb-collection","errorCode":null,"errorMessage":"Failed to create new AstraDB collection!","messagePattern":"Failed to create new AstraDB collection!","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/vectorDbProviders/astra/index.js","lineNumber":184,"sourceCode":"      const { pageContent, docId, ...metadata } = documentData;\n      if (!pageContent || pageContent.length == 0) return false;\n\n      this.logger(\"Adding new vectorized document into namespace\", namespace);\n      if (!skipCache) {\n        const cacheResult = await cachedVectorInformation(fullFilePath);\n        if (cacheResult.exists) {\n          const { client } = await this.connect();\n          const { chunks } = cacheResult;\n          const documentVectors = [];\n          vectorDimension = chunks[0][0].values.length || null;\n\n          const collection = await this.getOrCreateCollection(\n            client,\n            namespace,\n            vectorDimension\n          );\n          if (!(await this.isRealCollection(collection)))\n            throw new Error(\"Failed to create new AstraDB collection!\", {\n              namespace,\n            });\n\n          for (const chunk of chunks) {\n            // Before sending to Astra and saving the records to our db\n            // we need to assign the id of each chunk that is stored in the cached file.\n            const newChunks = chunk.map((chunk) => {\n              const _id = uuidv4();\n              documentVectors.push({ docId, vectorId: _id });\n              return {\n                _id: _id,\n                $vector: chunk.values,\n                metadata: chunk.metadata || {},\n              };\n            });\n\n            await collection.insertMany(newChunks);\n          }","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/vectorDbProviders/astra/index.js#L166-L202","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Retry the embed/document operation once - propagation lag on newly created collections is the most common cause.","Verify the ASTRA_DB_API_ENDPOINT and ASTRA_DB_APPLICATION_TOKEN are valid and the database is active (not paused) in the Astra console.","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.","Inspect the full error's attached { namespace } and server logs to confirm which collection failed."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await vectorDb.addDocumentToNamespace(namespace, buffer, filePath, metadata);\n} catch (e) {\n  if (/Failed to create new AstraDB collection/i.test(e.message)) {\n    await sleep(5000);            // Astra serverless propagation lag\n    return vectorDb.addDocumentToNamespace(namespace, buffer, filePath, metadata);\n  }\n  throw e;\n}","preventionTips":["Keep the Astra token database-scoped and verified before bulk embeds.","Confirm the database is Active (not paused) before scheduled ingest jobs.","Log the attached error.namespace to identify exactly which collection failed."],"tags":["astradb","vector-db","collection-creation","propagation"],"backgroundTag":"collection-creation-failed","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}