{"record":{"id":"fdaee1879563360a","repo":"diegosouzapw/OmniRoute","slug":"failed-to-create-collection-createres-status","errorCode":null,"errorMessage":"Failed to create collection (${createRes.status})","messagePattern":"Failed to create collection \\((.+?)\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/lib/memory/qdrant.ts","lineNumber":258,"sourceCode":"  const getRes = await qdrantFetch(cfg, `/collections/${encodeURIComponent(cfg.collection)}`, {\n    method: \"GET\",\n  });\n  if (getRes.ok) return;\n\n  // Quantization only applies to NEW collections — an existing collection is left\n  // untouched (the GET above returns early). Switching modes on a populated\n  // collection is a destructive recreate+reindex that must be an explicit UI action.\n  const quantizationConfig = buildQuantizationConfig(cfg.quantization);\n  const createRes = await qdrantFetch(cfg, `/collections/${encodeURIComponent(cfg.collection)}`, {\n    method: \"PUT\",\n    body: JSON.stringify({\n      vectors: { size: vectorSize, distance: \"Cosine\" },\n      ...(quantizationConfig ? { quantization_config: quantizationConfig } : {}),\n    }),\n  });\n  if (!createRes.ok) {\n    const text = await createRes.text().catch(() => \"\");\n    throw new Error(text.slice(0, 300) || `Failed to create collection (${createRes.status})`);\n  }\n}\n\nasync function getCollectionVectorName(cfg: QdrantConfig): Promise<string | null> {\n  const res = await qdrantFetch(cfg, `/collections/${encodeURIComponent(cfg.collection)}`, {\n    method: \"GET\",\n  });\n  if (!res.ok) return null;\n  const data = (await res.json().catch(() => null)) as any;\n  const vectors = data?.result?.config?.params?.vectors;\n  if (!vectors || typeof vectors !== \"object\" || Array.isArray(vectors)) {\n    return null;\n  }\n  // Unnamed/single-vector config: { size, distance, ... } (not a named map)\n  if (\n    Object.prototype.hasOwnProperty.call(vectors, \"size\") &&\n    (typeof vectors.size === \"number\" || typeof vectors.size === \"string\")\n  ) {","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/memory/qdrant.ts#L240-L276","documentation":"Error \"Failed to create collection (${createRes.status})\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/memory/qdrant.ts:258 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}