conductor-oss/conductor · error · RuntimeException
Gemini embedContent failed
Error message
Gemini embedContent failed
What it means
GeminiVertex.generateEmbeddings() catches any checked Exception (not RuntimeException) from the embedContent API call and wraps it with this generic message. The catch ordering is deliberate: RuntimeException (including error 190's message) is rethrown as-is at the first catch, then all other exceptions (IOException, etc.) are wrapped here. The original exception is preserved as the cause.
Source
Thrown at ai/src/main/java/org/conductoross/conductor/ai/providers/gemini/GeminiVertex.java:94
return List.of(ALIAS);
}
@Override
public List<Float> generateEmbeddings(EmbeddingGenRequest embeddingGenRequest) {
try {
GeminiApi.EmbedContentResponse resp =
geminiApi.embedContent(
embeddingGenRequest.getModel(),
embeddingGenRequest.getText(),
embeddingGenRequest.getDimensions());
if (resp.embedding() == null || resp.embedding().values() == null) {
throw new RuntimeException("No embeddings returned from Gemini API");
}
return resp.embedding().values();
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException("Gemini embedContent failed", e);
}
}
@Override
public ChatModel getChatModel() {
return new GeminiChatModel(geminiApi);
}
@Override
public ChatOptions getChatOptions(ChatCompletion input) {
return GeminiChatOptions.builder()
.model(input.getModel())
.temperature(input.getTemperature())
.maxTokens(input.getMaxTokens())
.frequencyPenalty(input.getFrequencyPenalty())
.presencePenalty(input.getPresencePenalty())
.stopSequences(input.getStopWords())
.topK(input.getTopK())View on GitHub (pinned to cf7c3e4a8a)
Solutions
- Inspect getCause() for the specific checked exception — it is always preserved.
- For IOException causes: verify network connectivity and API endpoint reachability.
- Verify the API key / Vertex AI credentials are valid for embeddings.
- Check if the response body was malformed — this may indicate an API version mismatch between the client and Google's endpoint.
Defensive patterns
Strategy: retry
Validate before calling
// Validate connectivity and credentials before calling
void validateGeminiEmbeddingConfig(String apiKey, String model) {
if (apiKey == null || apiKey.isBlank()) {
throw new IllegalArgumentException("Gemini API key required for embeddings");
}
if (model == null || model.isBlank()) {
throw new IllegalArgumentException("Embedding model name required");
}
} Try / catch
try {
return vertex.generateEmbeddings(request);
} catch (RuntimeException e) {
// Error 190's RuntimeException is rethrown as-is by GeminiVertex;
// this catches only the wrapped checked-exception path
if (e.getMessage().equals("Gemini embedContent failed")
&& e.getCause() instanceof java.io.IOException
&& isTransient(e.getCause())) {
Thread.sleep(2000);
return vertex.generateEmbeddings(request);
}
throw new RuntimeException("Gemini embeddings transport failure", e);
} Prevention
- Verify network connectivity to the Gemini embeddings endpoint.
- Ensure the API key or Vertex AI credentials are valid and non-expired.
- Distinguish this (wrapped checked exception) from error 190 (RuntimeException rethrown as-is) by message.
- Use retry with backoff for transient IOException causes.
When it happens
Trigger: An IOException or other checked exception during the HTTP call to the Gemini embedContent endpoint: connection timeout, DNS failure, HTTP 4xx/5xx from Google's embeddings API, or a JSON deserialization error on the response.
Common situations: Network connectivity issues to Google's API. Invalid or expired API key causing a 401/403. Vertex AI project/location misconfiguration. Rate limiting from the embeddings endpoint. Response body malformed (not valid JSON for EmbedContentResponse).
Related errors
- Embeddings API call failed: {message}
- Gemini generateContent failed: {message}
- Gemini generateImages failed: {message}
- Failed to download from {url}
- Gemini generateAudio failed
AI-assisted analysis of conductor-oss/conductor@cf7c3e4a8a (2026-08-14).
Data as JSON: /api/errors/365cfecb361e4dc3.
Report an issue: GitHub.