apache/seatunnel · error · SlackConnectorException
WRITE_TO_SLACK_CHANNEL_FAILED
WRITE_TO_SLACK_CHANNEL_FAILED
Error message
Write to Slack Fail.
What it means
SlackWriter.write posts a message to a Slack channel via SlackClient.publishMessage, then sleeps ~1s to respect Slack's send-rate limits. Any exception — publish failure, network error, or interruption during sleep — is logged and rethrown as SlackConnectorException with code WRITE_TO_SLACK_CHANNEL_FAILED. It signals the sink could not deliver a message to the configured conversation.
Solutions
- Check the logged ExceptionUtils.getMessage(e) for the root cause (auth vs channel vs rate limit).
- Verify the bot token has chat:write scope and the bot is invited to the target channel.
- Confirm the conversation ID is valid and the channel is active.
- Reduce sink parallelism/throughput or add buffering if hitting Slack rate limits.
- Treat InterruptedException specially if job cancellation is repeatedly triggering this error.
Example fix
// before: broad catch turns cancellation into a write failure
catch (Exception e) { throw new SlackConnectorException(..., e); }
// after
try {
slackClient.publishMessage(conversationId, message);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return; // honor cancellation
} catch (Exception e) {
throw new SlackConnectorException(WRITE_TO_SLACK_CHANNEL_FAILED, e);
} Defensive patterns
Strategy: retry
Validate before calling
// pre-check channel membership and scope
callSlackApi("conversations.info", Map.of("channel", conversationId)); // validates channel + access Try / catch
try {
slackWriter.write(conversationId, message);
} catch (SlackConnectorException e) {
if (isRateLimited(e)) {
Thread.sleep(backoff); retry();
} else {
log.error("Permanent Slack write failure: {}", ExceptionUtils.getMessage(e));
throw e;
}
} Prevention
- Keep sink parallelism low; Slack limits ~1 message/second per channel.
- Verify chat:write scope and bot channel membership before jobs run.
- Batch or buffer messages instead of sending one per row.
- Check ExceptionUtils.getMessage output in logs to classify auth vs rate-limit errors.
When it happens
Trigger: write(conversationId, message) fails because publishMessage throws (invalid channel ID, invalid/expired token, missing chat:write scope, message rejected, rate limit) or Thread.sleep is interrupted (InterruptedException caught by the broad catch(Exception)).
Common situations: Wrong channel ID after channel deletion/archival; bot lacking chat:write scope or not a member of the channel; Slack 429 rate limits on high-throughput sinks; job cancellation interrupting the rate-limit sleep.
Related errors
- Airtable API rate limit reached, retry
- All candidate sink tables were skipped in Flink starter.
- All candidate sink tables were skipped in Flink starter.
- All candidate sink tables were skipped in Spark starter.
- All candidate sink tables were skipped in Spark starter.
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/e1d4b13e7d9a2a55.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-connectors-v2/connector-slack/src/main/java/org/apache/seatunnel/connectors/seatunnel/slack/sink/SlackWriter.java:62
this.conversationId = slackClient.findConversation();
}
@Override
public void write(SeaTunnelRow element) throws IOException {
Object[] fields = element.getFields();
StringJoiner stringJoiner = new StringJoiner(",", "", "\n");
for (Object field : fields) {
stringJoiner.add(String.valueOf(field));
}
String message = stringJoiner.toString();
try {
slackClient.publishMessage(conversationId, message);
// Slack has a limit on the frequency of sending messages
// One message can be sent as soon as one second
Thread.sleep(POST_MSG_WAITING_TIME);
} catch (Exception e) {
log.error("Write to Slack Fail.", ExceptionUtils.getMessage(e));
throw new SlackConnectorException(
SlackConnectorErrorCode.WRITE_TO_SLACK_CHANNEL_FAILED, e);
}
}
@Override
public void close() throws IOException {}
}
View on GitHub (pinned to cf67b549a7)