{"record":{"id":"af28a7082cd731ed","repo":"apache/flink","slug":"one-or-more-fetchers-have-encountered-exception","errorCode":null,"errorMessage":"One or more fetchers have encountered exception","messagePattern":"One or more fetchers have encountered exception","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"flink-connectors/flink-connector-base/src/main/java/org/apache/flink/connector/base/source/reader/fetcher/SplitFetcherManager.java","lineNumber":350,"sourceCode":"                                    e);\n                            break;\n                        }\n                        timeElapsed = System.currentTimeMillis() - startTime;\n                    }\n                });\n        executors.shutdown();\n        long timeElapsed = System.currentTimeMillis() - startTime;\n        if (!executors.awaitTermination(timeoutMs - timeElapsed, TimeUnit.MILLISECONDS)) {\n            LOG.warn(\n                    \"Failed to close the split fetchers in {} ms. There are still {} split fetchers running\",\n                    timeoutMs,\n                    fetchersToShutDown.get());\n        }\n    }\n\n    public void checkErrors() {\n        if (uncaughtFetcherException.get() != null) {\n            throw new RuntimeException(\n                    \"One or more fetchers have encountered exception\",\n                    uncaughtFetcherException.get());\n        }\n    }\n\n    // -----------------------\n\n    @VisibleForTesting\n    public int getNumAliveFetchers() {\n        return fetchers.size();\n    }\n}\n","sourceCodeStart":332,"sourceCodeEnd":363,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-connectors/flink-connector-base/src/main/java/org/apache/flink/connector/base/source/reader/fetcher/SplitFetcherManager.java#L332-L363","documentation":"SplitFetcherManager#checkErrors throws a RuntimeException wrapping uncaughtFetcherException if any fetcher thread terminated with an uncaught exception. Source readers call this periodically to propagate fetch-thread failures to the main thread so the source fails fast rather than silently stalling.","triggerScenarios":"A SplitFetcher thread's UncaughtExceptionHandler recorded an exception (commonly the RuntimeException from error 123 or 124). The next time the source reader calls checkErrors(), the stored exception is rethrown.","commonSituations":"Any unhandled error in a SplitReader (network, deserialization, auth) that killed a fetch thread. The root cause is the wrapped uncaughtFetcherException.","solutions":["Inspect the wrapped cause (uncaughtFetcherException) to find the originating fetcher error and fix the underlying connector/data problem.","If the cause is transient, rely on the job restart strategy to recover after you resolve the external issue.","Verify the SplitReader handles recoverable errors internally so they do not kill the fetch thread.","Ensure checkErrors is being called in your source reader loop so failures are not swallowed."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    splitFetcherManager.checkErrors();\n} catch (RuntimeException e) {\n    Throwable cause = e.getCause();\n    // cause is the original uncaught fetcher exception; act on it\n    throw e;\n}","preventionTips":["Call checkErrors() regularly in your SourceReader loop so failures surface promptly.","Never swallow the wrapped cause; it is the actionable root error.","Ensure SplitReader implementations do not leave the fetch thread in a dead state."],"tags":["fetcher-manager","error-propagation","runtime","flink-source"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}