{"record":{"id":"5084873e6fed9fe7","repo":"apache/beam","slug":"error-writing-to-solr-no-attempt-made-to-retry","errorCode":null,"errorMessage":"Error writing to Solr (no attempt made to retry)","messagePattern":"Error writing to Solr \\(no attempt made to retry\\)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/solr/src/main/java/org/apache/beam/sdk/io/solr/SolrIO.java","lineNumber":667,"sourceCode":"        }\n        try {\n          UpdateRequest updateRequest = new UpdateRequest();\n          updateRequest.add(batch);\n\n          Sleeper sleeper = Sleeper.DEFAULT;\n          BackOff backoff = retryBackoff.backoff();\n          int attempt = 0;\n          while (true) {\n            attempt++;\n            try {\n              solrClient.process(spec.getCollection(), updateRequest);\n              break;\n            } catch (Exception exception) {\n\n              // fail immediately if no retry configuration doesn't handle this\n              if (spec.getRetryConfiguration() == null\n                  || !spec.getRetryConfiguration().getRetryPredicate().test(exception)) {\n                throw new IOException(\n                    \"Error writing to Solr (no attempt made to retry)\", exception);\n              }\n\n              // see if we can pause and try again\n              if (!BackOffUtils.next(sleeper, backoff)) {\n                throw new IOException(\n                    String.format(\n                        \"Error writing to Solr after %d attempt(s). No more attempts allowed\",\n                        attempt),\n                    exception);\n\n              } else {\n                // Note: this used in test cases to verify behavior\n                LOG.warn(String.format(RETRY_ATTEMPT_LOG, attempt), exception);\n              }\n            }\n          }\n        } finally {","sourceCodeStart":649,"sourceCodeEnd":685,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/solr/src/main/java/org/apache/beam/sdk/io/solr/SolrIO.java#L649-L685","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Configure a RetryConfiguration with a predicate covering the transient errors you expect: .withRetryConfiguration(SolrIO.RetryConfiguration.create(...))","Fix the underlying non-retryable cause (check the chained exception: auth, schema, collection)","Validate documents against the Solr schema before writing (required fields, field types)","Ensure Solr credentials/URLs in ConnectionConfiguration are correct"],"exampleFix":"// before\nSolrIO.write(solrIO); // no retry config -> immediate failure on any exception\n// after\nSolrIO.write(solrIO)\n    .withRetryConfiguration(SolrIO.RetryConfiguration.create(10, org.joda.time.Duration.standardSeconds(1)));","handlingStrategy":"retry","validationCode":"if (solrIOWrite.getRetryConfiguration() == null) {\n  throw new IllegalArgumentException(\"Configure a RetryConfiguration for SolrIO.write\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  result.get();\n} catch (Exception e) {\n  Throwable cause = e.getCause();\n  LOG.error(\"Non-retryable Solr write error: \" + cause.getMessage(), cause);\n}","preventionTips":["Always call withRetryConfiguration on SolrIO.write","Classify retryable vs non-retryable exceptions in the retry predicate","Validate document schema conformance before writing","Verify Solr credentials and connection settings"],"tags":["java","beam","solr","retry","write"],"backgroundTag":"api-request-failed","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}