chroma-core/chroma · error · Error
Error calling Jina AI API: ${error.message}
Error message
Error calling Jina AI API: ${error.message} What it means
The outer catch in JinaEmbeddingFunction.generate() wraps every failure — fetch network errors (DNS, ECONNREFUSED, TLS), JSON parse errors on non-JSON bodies, and even the inner data.detail Error from error 50 (yielding 'Error calling Jina AI API: <server detail>') — into a single prefixed Error. Only the message text survives; the original error class, stack context, and cause chain are lost.
Source
Thrown at clients/js/packages/chromadb-core/src/embeddings/JinaEmbeddingFunction.ts:132
try {
const response = await fetch(this.api_url, {
method: "POST",
headers: this.headers,
body: JSON.stringify(json_body),
});
const data = (await response.json()) as { data: any[]; detail: string };
if (!data || !data.data) {
throw new Error(data.detail);
}
const embeddings: any[] = data.data;
const sortedEmbeddings = embeddings.sort((a, b) => a.index - b.index);
return sortedEmbeddings.map((result) => result.embedding);
} catch (error) {
if (error instanceof Error) {
throw new Error(`Error calling Jina AI API: ${error.message}`);
} else {
throw new Error(`Error calling Jina AI API: ${error}`);
}
}
}
buildFromConfig(config: StoredConfig): JinaEmbeddingFunction {
return new JinaEmbeddingFunction({
model_name: config.model_name,
api_key_env_var: config.api_key_env_var,
task: config.task,
late_chunking: config.late_chunking,
truncate: config.truncate,
dimensions: config.dimensions,
embedding_type: config.embedding_type,
normalized: config.normalized,
});
}View on GitHub (pinned to aecdd12c8a)
Solutions
- Inspect the text after 'Error calling Jina AI API:' — it carries the root cause (e.g. 'fetch failed', 'Invalid API key')
- Reproduce connectivity from the same host/container: curl -sS https://api.jina.ai/v1/embeddings to distinguish network from auth issues
- Add api.jina.ai to proxy/egress allowlists or fix proxy env vars
- If the suffix is a Jina detail string, apply the fix for that underlying error (key, quota, model)
Example fix
// before (library code): opaque wrapper loses the cause
throw new Error(`Error calling Jina AI API: ${error.message}`);
// after (library-level): rethrow untouched so stack/cause survive
throw error; Defensive patterns
Strategy: try-catch
Validate before calling
async function jinaReachable(): Promise<boolean> {
try {
await fetch("https://api.jina.ai", { method: "HEAD", signal: AbortSignal.timeout(5_000) });
return true; // any HTTP answer proves DNS/TLS/egress work
} catch {
return false;
}
}
// run at startup in restricted-network environments Try / catch
try {
const vecs = await ef.generate(texts);
} catch (e) {
const msg = e instanceof Error ? e.message : String(e);
if (msg.startsWith("Error calling Jina AI API:")) {
const cause = msg.slice("Error calling Jina AI API:".length).trim();
// classify: 'fetch failed' -> network/egress; anything else -> server detail (auth/quota/model)
}
throw e;
} Prevention
- Add api.jina.ai to proxy/egress allowlists and verify HTTPS_PROXY settings in containers
- Set explicit fetch timeouts so hung requests fail fast instead of blocking batches
- Log the unwrapped cause text; the library's wrapper hides the original error class
When it happens
Trigger: api.jina.ai unreachable (offline environment, blocked egress, proxy misconfiguration); a proxy/captive portal returning an HTML error page so response.json() throws; or the inner !data.data branch throwing first and being re-wrapped here.
Common situations: Corporate proxies blocking api.jina.ai; air-gapped environments; misconfigured HTTPS_PROXY; double-wrapped detail errors making logs noisy and hard to alert on.
Related errors
- Error calling Cloudflare Workers AI API: ${error.message}
- Error calling Jina AI API: ${error}
- Error calling Together AI API: ${error.message}
- Error calling Chroma Embedding API: ${error.message}
- Failed to connect to Chroma
AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16).
Data as JSON: /api/errors/7a95397a219f0964.
Report an issue: GitHub.