apache/beam · error · IOException

Error writing to Solr (no attempt made to retry)

Error message

Error writing to Solr (no attempt made to retry)

What it means

SolrIO's write path retries failed add/commit requests according to the configured RetryConfiguration. When an exception occurs that the retry predicate does not accept (or no RetryConfiguration is set), the writer fails immediately with this IOException instead of retrying, preserving the original exception as the cause.

Source

Thrown at sdks/java/io/solr/src/main/java/org/apache/beam/sdk/io/solr/SolrIO.java:667

        }
        try {
          UpdateRequest updateRequest = new UpdateRequest();
          updateRequest.add(batch);

          Sleeper sleeper = Sleeper.DEFAULT;
          BackOff backoff = retryBackoff.backoff();
          int attempt = 0;
          while (true) {
            attempt++;
            try {
              solrClient.process(spec.getCollection(), updateRequest);
              break;
            } catch (Exception exception) {

              // fail immediately if no retry configuration doesn't handle this
              if (spec.getRetryConfiguration() == null
                  || !spec.getRetryConfiguration().getRetryPredicate().test(exception)) {
                throw new IOException(
                    "Error writing to Solr (no attempt made to retry)", exception);
              }

              // see if we can pause and try again
              if (!BackOffUtils.next(sleeper, backoff)) {
                throw new IOException(
                    String.format(
                        "Error writing to Solr after %d attempt(s). No more attempts allowed",
                        attempt),
                    exception);

              } else {
                // Note: this used in test cases to verify behavior
                LOG.warn(String.format(RETRY_ATTEMPT_LOG, attempt), exception);
              }
            }
          }
        } finally {

View on GitHub (pinned to 12126d8942)

Solutions

  1. Configure a RetryConfiguration with a predicate covering the transient errors you expect: .withRetryConfiguration(SolrIO.RetryConfiguration.create(...))
  2. Fix the underlying non-retryable cause (check the chained exception: auth, schema, collection)
  3. Validate documents against the Solr schema before writing (required fields, field types)
  4. Ensure Solr credentials/URLs in ConnectionConfiguration are correct

Example fix

// before
SolrIO.write(solrIO); // no retry config -> immediate failure on any exception
// after
SolrIO.write(solrIO)
    .withRetryConfiguration(SolrIO.RetryConfiguration.create(10, org.joda.time.Duration.standardSeconds(1)));
Defensive patterns

Strategy: retry

Validate before calling

if (solrIOWrite.getRetryConfiguration() == null) {
  throw new IllegalArgumentException("Configure a RetryConfiguration for SolrIO.write");
}

Try / catch

try {
  result.get();
} catch (Exception e) {
  Throwable cause = e.getCause();
  LOG.error("Non-retryable Solr write error: " + cause.getMessage(), cause);
}

Prevention

When it happens

Trigger: Solr add/commit throws an exception that either no RetryConfiguration is configured for (spec.getRetryConfiguration() == null) or whose retry predicate returns false for — e.g. authentication failures, malformed documents, or non-retryable HTTP errors.

Common situations: Missing withRetryConfiguration() on the write; Solr returning 401/403 or schema errors that the default predicate deems non-retryable; documents violating Solr schema (missing unique key, bad field types).

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/5084873e6fed9fe7. Report an issue: GitHub.