{"record":{"id":"d7f07fd2925e46e0","repo":"chroma-core/chroma","slug":"the-requested-resource-could-not-be-found","errorCode":null,"errorMessage":"The requested resource could not be found","messagePattern":"The requested resource could not be found","errorType":"http","errorClass":"ChromaNotFoundError","httpStatus":404,"severity":"error","filePath":"clients/new-js/packages/chromadb/src/chroma-fetch.ts","lineNumber":82,"sourceCode":"    case 400:\n      let status = \"Bad Request\";\n      try {\n        const responseBody = await response.json();\n        status = responseBody.message || status;\n      } catch {}\n      throw new ChromaClientError(\n        `Bad request to ${\n          (input as Request).url || \"Chroma\"\n        } with status: ${status}`,\n      );\n    case 401:\n      throw new ChromaUnauthorizedError(`Unauthorized`);\n    case 403:\n      throw new ChromaForbiddenError(\n        `You do not have permission to access the requested resource.`,\n      );\n    case 404:\n      throw new ChromaNotFoundError(\n        `The requested resource could not be found`,\n      );\n    case 409:\n      const conflictBody = await getErrorBody(response);\n      if (\n        conflictBody.error === \"ConditionalWriteConflictError\" ||\n        conflictBody.message === \"conditional write conflict\"\n      ) {\n        throw new ChromaConditionalWriteConflictError(\n          conflictBody.message || \"conditional write conflict\",\n        );\n      }\n      throw new ChromaUniqueError(\n        conflictBody.message || \"The resource already exists\",\n      );\n    case 412:\n      const preconditionBody = await getErrorBody(response);\n      if (preconditionBody.error === \"StaleReadError\") {","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/clients/new-js/packages/chromadb/src/chroma-fetch.ts#L64-L100","documentation":"Thrown by chromaFetch (chroma-fetch.ts:82) as a ChromaNotFoundError when the server returns HTTP 404: the addressed resource (collection, tenant, database, or route) does not exist. Note the library's own getCollection()/deleteCollection() surface this when the named collection is absent, and raw 404s from wrong URLs also map here.","triggerScenarios":"Calling collection operations on a deleted or never-created collection name/ID; targeting a non-existent tenant or database in the path; hitting an API route that does not exist because the server is older than the client expects.","commonSituations":"Collections deleted by another process or teammate between list and use; fresh environments where seed collections were never created; typos in collection names; version skew exposing missing routes.","solutions":["List existing collections (await client.listCollections()) and compare names/IDs before operating.","If the collection should exist, create it (getOrCreateCollection) or fix the name/ID typo.","Verify the tenant/database in the client config actually exist for your key.","Align client and server versions if the 404 comes from a missing API route."],"exampleFix":"// before\nconst col = await client.getCollection({ name: \"prod-data\" }); // 404 if never created\n\n// after\nconst col = await client.getOrCreateCollection({ name: \"prod-data\", embeddingFunction });","handlingStrategy":"validation","validationCode":"const names = new Set((await client.listCollections()).map(c => c.name));\nif (!names.has(\"docs\")) {\n  await client.createCollection({ name: \"docs\", embeddingFunction });\n}","typeGuard":null,"tryCatchPattern":"try {\n  return await client.getCollection({ name });\n} catch (e) {\n  if (e instanceof ChromaNotFoundError) {\n    return await client.createCollection({ name, embeddingFunction }); // or return null\n  }\n  throw e;\n}","preventionTips":["Prefer getOrCreateCollection() for idempotent provisioning.","Re-check existence after environment resets (test teardown, DB recreation).","Handle ChromaNotFoundError explicitly where a missing collection is expected."],"tags":["http-404","not-found","collection","lifecycle"],"backgroundTag":"resource-not-found","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}