{"record":{"id":"8f273998b3d5c636","repo":"apache/flink","slug":"splitfetcher-thread-d-received-unexpected-excepti","errorCode":null,"errorMessage":"SplitFetcher thread %d received unexpected exception while polling the records","messagePattern":"SplitFetcher thread (.+?) received unexpected exception while polling the records","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/SplitFetcher.java","lineNumber":195,"sourceCode":"            task = getNextTaskUnsafe();\n            if (task == null) {\n                // (spurious) wakeup, so just repeat\n                return true;\n            }\n\n            LOG.debug(\"Prepare to run {}\", task);\n            // store task for #wakeUp\n            this.runningTask = task;\n        } finally {\n            lock.unlock();\n        }\n\n        // execute the task outside of lock, so that it can be woken up\n        boolean taskFinished;\n        try {\n            taskFinished = task.run();\n        } catch (Exception e) {\n            throw new RuntimeException(\n                    String.format(\n                            \"SplitFetcher thread %d received unexpected exception while polling the records\",\n                            id),\n                    e);\n        }\n\n        // re-acquire lock as all post-processing steps, need it\n        lock.lock();\n        try {\n            this.runningTask = null;\n            processTaskResultUnsafe(task, taskFinished);\n        } finally {\n            lock.unlock();\n        }\n        return true;\n    }\n\n    private void processTaskResultUnsafe(SplitFetcherTask task, boolean taskFinished) {","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-connectors/flink-connector-base/src/main/java/org/apache/flink/connector/base/source/reader/fetcher/SplitFetcher.java#L177-L213","documentation":"SplitFetcher catches any Exception thrown by a SplitFetcherTask#run (typically FetchTask, which calls SplitReader#fetch) and re-throws it as a RuntimeException identifying the fetcher thread by id. This is the primary path by which errors inside a split reader surface from the fetch thread.","triggerScenarios":"SplitReader#fetch throws (network error, deserialization failure, auth expiry), or any AddSplitsTask / wakeup-related task throws during task.run(). The exception is set on the SplitFetcher and later surfaced via SplitFetcherManager#checkErrors.","commonSituations":"Connector read failure: broker disconnect, HTTP 4xx/5xx, malformed records, transient I/O errors, SplitReader misuse. The concrete cause is in the wrapped Throwable.","solutions":["Read the nested cause to find the real connector-level exception and address it (reconnect, fix data, refresh credentials).","If the cause is transient, configure the connector/source for retry or restart-strategy to recover automatically.","If the cause is a poison-pill record, enable side-output / DLQ or filter invalid data upstream.","Confirm the SplitReader implementation is not throwing for non-fatal conditions it should handle internally."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// In a custom SourceReader, surface fetcher errors explicitly:\nsplitFetcherManager.checkErrors();\ntry {\n    // process records\n} catch (RuntimeException e) {\n    Throwable cause = e.getCause() != null ? e.getCause() : e;\n    log.warn(\"Fetch task failed: {}\", cause.toString());\n    throw e;\n}","preventionTips":["Implement SplitReader#fetch to handle recoverable errors internally rather than throwing.","Configure a job restart strategy so transient fetch failures self-heal.","Log the nested cause, not just the wrapper, to find the real connector error."],"tags":["fetcher","split-reader","runtime","flink-source"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}