{"record":{"id":"31f1fed02b9f7f64","repo":"weaviate/weaviate","slug":"no-api-key-found-neither-in-request-header-x-jina","errorCode":null,"errorMessage":"no api key found neither in request header: X-Jinaai-Api-Key nor in environment variable under JINAAI_APIKEY","messagePattern":"no api key found neither in request header: X-Jinaai-Api-Key nor in environment variable under JINAAI_APIKEY","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/reranker-jinaai/clients/ranker.go","lineNumber":209,"sourceCode":"\t}\n}\n\nfunc (c *client) getApiKey(ctx context.Context) (string, error) {\n\tif len(c.apiKey) > 0 {\n\t\treturn c.apiKey, nil\n\t}\n\tkey := \"X-Jinaai-Api-Key\"\n\n\tapiKey := ctx.Value(key)\n\t// try getting header from GRPC if not successful\n\tif apiKey == nil {\n\t\tapiKey = modulecomponents.GetValueFromGRPC(ctx, key)\n\t}\n\tif apiKeyHeader, ok := apiKey.([]string); ok &&\n\t\tlen(apiKeyHeader) > 0 && len(apiKeyHeader[0]) > 0 {\n\t\treturn apiKeyHeader[0], nil\n\t}\n\treturn \"\", errors.New(\"no api key found \" +\n\t\t\"neither in request header: X-Jinaai-Api-Key \" +\n\t\t\"nor in environment variable under JINAAI_APIKEY\")\n}\n\ntype RankInput struct {\n\tDocuments []string `json:\"documents\"`\n\tQuery     string   `json:\"query\"`\n\tModel     string   `json:\"model\"`\n\tTopN      int      `json:\"top_n,omitempty\"`\n}\n\ntype Result struct {\n\tIndex          int     `json:\"index\"`\n\tRelevanceScore float64 `json:\"relevance_score\"`\n\tDocument       string  `json:\"document\"`\n}\n\ntype APIVersion struct {","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/modules/reranker-jinaai/clients/ranker.go#L191-L227","documentation":"The reranker-jinaai client's getApiKey cannot find a Jina AI API key. The key is resolved from the request header X-Jinaai-Api-Key, the gRPC request metadata, or the environment variable JINAAI_APIKEY. If none is present, inference requests to Jina AI cannot authenticate and the client aborts with this error.","triggerScenarios":"Calling Generate/rerank through the jinaai reranker without setting the X-Jinaai-Api-Key request header (REST or gRPC metadata) and without JINAAI_APIKEY set in the Weaviate server environment; or the header value is present but empty.","commonSituations":"Forgetting to set the env var in docker-compose/Kubernetes deployments; sending the header with the wrong name or empty value; adding the header to the client but not allow-listing it if a proxy strips it.","solutions":["Set the environment variable JINAAI_APIKEY on the Weaviate server process/container","Send the header X-Jinaai-Api-Key: <key> on the REST request, or the equivalent gRPC metadata","Verify the value is non-empty and correctly spelled (JINAAI_APIKEY, not JINA_API_KEY)","Restart Weaviate after changing environment variables so the module client picks it up"],"exampleFix":"// before\ncurl ... -H 'Content-Type: application/json' -d '{\"query\":\"...\"}'\n// after\ncurl ... -H 'X-Jinaai-Api-Key: $JINA_KEY' -H 'Content-Type: application/json' -d '{\"query\":\"...\"}'","handlingStrategy":"validation","validationCode":"if os.Getenv(\"JINAAI_APIKEY\") == \"\" && request.Header.Get(\"X-Jinaai-Api-Key\") == \"\" { return errors.New(\"set JINAAI_APIKEY or X-Jinaai-Api-Key header before querying\") }","typeGuard":null,"tryCatchPattern":"if strings.Contains(err.Error(), \"no api key found\") { // surface config error: log setup instructions and abort rather than retry }","preventionTips":["Set JINAAI_APIKEY in deployment env (docker-compose, Helm values)","Send X-Jinaai-Api-Key on inference requests when using per-request keys","Verify key presence in startup health checks","Restart services after env changes"],"tags":["api-key","authentication","reranker","weaviate"],"backgroundTag":"missing-api-key","analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}