weaviate/weaviate · error

no api key found neither in request header: X-Jinaai-Api-Key

Error message

no api key found neither in request header: X-Jinaai-Api-Key nor in environment variable under JINAAI_APIKEY

What it means

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.

Source

Thrown at modules/reranker-jinaai/clients/ranker.go:209

	}
}

func (c *client) getApiKey(ctx context.Context) (string, error) {
	if len(c.apiKey) > 0 {
		return c.apiKey, nil
	}
	key := "X-Jinaai-Api-Key"

	apiKey := ctx.Value(key)
	// try getting header from GRPC if not successful
	if apiKey == nil {
		apiKey = modulecomponents.GetValueFromGRPC(ctx, key)
	}
	if apiKeyHeader, ok := apiKey.([]string); ok &&
		len(apiKeyHeader) > 0 && len(apiKeyHeader[0]) > 0 {
		return apiKeyHeader[0], nil
	}
	return "", errors.New("no api key found " +
		"neither in request header: X-Jinaai-Api-Key " +
		"nor in environment variable under JINAAI_APIKEY")
}

type RankInput struct {
	Documents []string `json:"documents"`
	Query     string   `json:"query"`
	Model     string   `json:"model"`
	TopN      int      `json:"top_n,omitempty"`
}

type Result struct {
	Index          int     `json:"index"`
	RelevanceScore float64 `json:"relevance_score"`
	Document       string  `json:"document"`
}

type APIVersion struct {

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Set the environment variable JINAAI_APIKEY on the Weaviate server process/container
  2. Send the header X-Jinaai-Api-Key: <key> on the REST request, or the equivalent gRPC metadata
  3. Verify the value is non-empty and correctly spelled (JINAAI_APIKEY, not JINA_API_KEY)
  4. Restart Weaviate after changing environment variables so the module client picks it up

Example fix

// before
curl ... -H 'Content-Type: application/json' -d '{"query":"..."}'
// after
curl ... -H 'X-Jinaai-Api-Key: $JINA_KEY' -H 'Content-Type: application/json' -d '{"query":"..."}'
Defensive patterns

Strategy: validation

Validate before calling

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") }

Try / catch

if strings.Contains(err.Error(), "no api key found") { // surface config error: log setup instructions and abort rather than retry }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "API key is required" / "API key not found" / "No API key was set": the missing-api-key error family across 16 libraries — this error's family across 16 libraries.

Related errors


AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04). Data as JSON: /api/errors/31f1fed02b9f7f64. Report an issue: GitHub.