{"record":{"id":"ea0760ccb8e27f28","repo":"chroma-core/chroma","slug":"data-detail","errorCode":null,"errorMessage":"data.detail","messagePattern":"data\\.detail","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"clients/js/packages/chromadb-core/src/embeddings/JinaEmbeddingFunction.ts","lineNumber":123,"sourceCode":"\n    if (this.embedding_type) {\n      json_body.embedding_type = this.embedding_type;\n    }\n\n    if (this.normalized) {\n      json_body.normalized = this.normalized;\n    }\n\n    try {\n      const response = await fetch(this.api_url, {\n        method: \"POST\",\n        headers: this.headers,\n        body: JSON.stringify(json_body),\n      });\n\n      const data = (await response.json()) as { data: any[]; detail: string };\n      if (!data || !data.data) {\n        throw new Error(data.detail);\n      }\n\n      const embeddings: any[] = data.data;\n      const sortedEmbeddings = embeddings.sort((a, b) => a.index - b.index);\n\n      return sortedEmbeddings.map((result) => result.embedding);\n    } catch (error) {\n      if (error instanceof Error) {\n        throw new Error(`Error calling Jina AI API: ${error.message}`);\n      } else {\n        throw new Error(`Error calling Jina AI API: ${error}`);\n      }\n    }\n  }\n\n  buildFromConfig(config: StoredConfig): JinaEmbeddingFunction {\n    return new JinaEmbeddingFunction({\n      model_name: config.model_name,","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/clients/js/packages/chromadb-core/src/embeddings/JinaEmbeddingFunction.ts#L105-L141","documentation":"After POSTing to the Jina embeddings API, the code parses the JSON body and throws new Error(data.detail) whenever the payload has no data array. detail is the FastAPI-style error field Jina returns on failures, so the thrown message is the server's own text (e.g. \"Invalid API key\"). Note response.ok is never checked: every JSON error response funnels here, while a non-JSON body makes response.json() throw and surfaces as the wrapped error 51 instead.","triggerScenarios":"Jina responds 401/403 (invalid or missing Bearer token), 429 (rate/quota exceeded), or 422 (unsupported model_name/dimensions/embedding_type combination) with a { detail: \"...\" } body and no data field.","commonSituations":"Expired, revoked or typo'd Jina key; free-tier quota exhausted mid-job; requesting dimensions on a model without Matryoshka support; wrong model_name string; late_chunking flag unsupported for the account/model.","solutions":["Read error.message — it IS Jina's detail text and names the actual problem; log it verbatim","For auth problems, verify the key: curl -s https://api.jina.ai/v1/embeddings -H \"Authorization: Bearer $KEY\" -H 'Content-Type: application/json' -d '{\"model\":\"jina-embeddings-v3\",\"input\":[\"ping\"]}'","For 429s, reduce batch size/frequency and honor rate limits before resuming","Check model_name, dimensions, and embedding_type against the current Jina embeddings API docs"],"exampleFix":"// before (library code): message is just the server's detail string\nthrow new Error(data.detail); // e.g. \"Invalid API key\"\n\n// after (library-level): keep the status context\nif (!response.ok || !data?.data) {\n  throw new Error(`Jina API error ${response.status}: ${data?.detail ?? response.statusText}`);\n}","handlingStrategy":"try-catch","validationCode":"function validateJinaRequest(opts: { apiKey?: string; model: string; texts: string[] }): void {\n  if (!opts.apiKey) throw new Error(\"Jina API key missing — check the env var named by api_key_env_var\");\n  if (opts.texts.length === 0) throw new Error(\"texts must be non-empty\");\n  if (!opts.model.startsWith(\"jina-\")) throw new Error(`Suspicious model name: ${opts.model}`);\n}\n// run before calling generate(); it prevents the common 401/422 detail errors","typeGuard":null,"tryCatchPattern":"try {\n  const vecs = await ef.generate(texts);\n} catch (e) {\n  const msg = e instanceof Error ? e.message : String(e);\n  if (/API key|auth/i.test(msg)) throw new Error(`Jina auth failed — rotate/check the key`);\n  if (/rate|quota|429/i.test(msg)) await backoffAndRetry(); // transient\n  throw e;\n}","preventionTips":["Run a one-token smoke embed at startup to validate key, model and quota before real traffic","Keep model_name/dimensions/embedding_type in sync with the current Jina API docs","Log error.message verbatim — for this error it IS the server's detail text"],"tags":["api","jina","embeddings","http","error-response","auth"],"backgroundTag":"upstream-api-error","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}