fix(slack): warn (not error) on routine Slack API conditions#3664
Merged
Conversation
Two call sites in slack/client.ts fired ":rotating_light: System error:
slack-client" alerts today for what are routine third-party states, not
server failures:
- getSlackUser: user_not_found is normal for deactivated/deleted users
and stale references from old messages. Already returns null; downgrade
the log to warn.
- inviteToChannel: not_in_channel (bot isn't a member yet), channel_not_found,
is_archived, user_is_restricted, user_is_ultra_restricted, user_disabled
are all expected Slack states. Already returns { ok: false, error }; the
caller decides what to do. Downgrade log to warn for these specific codes.
Other failure paths in the file still log at error for unknown failures.
Follows the logger.error vs logger.warn convention added in the JSDoc.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stop paging on routine Slack API conditions — three alerts today (3:59, 6:55, 6:57 AM UTC) were
:rotating_light: *System error: slack-client*for what are normal third-party states.What was paging
inviteToChannel(slack/client.ts:1122)not_in_channelgetSlackUser(slack/client.ts:243)user_not_foundgetSlackUseruser_not_foundBoth functions already do the right thing (return
null/{ ok: false, error }); only the log level was wrong.Fix
getSlackUser: loguser_not_foundatwarn, everything else stillerror.inviteToChannel: lognot_in_channel,channel_not_found,is_archived,user_is_restricted,user_is_ultra_restricted,user_disabledatwarn. Unknown failures stillerror.Follows the
logger.errorvslogger.warnconvention added in #3650's JSDoc —errorlevel triggers Slack#aao-errorsand PostHog$exception, so it should be reserved for unexpected, page-worthy failures.Out of scope
There are 11 other
logger.errorsites inslack/client.ts(and many more acrossaddie/mcp/*). Triaging the lot would be a much bigger PR with a lot of judgment calls about which Slack codes are "routine" per call site. This PR fixes only the three that fired today; the rest will follow as alerts surface, which is the lower-risk way to grade them.Test plan
tsc --noEmit— cleantest:unit + test-dynamic-imports + typecheck) — passed#aao-errorsfor absence of system-error alerts onnot_in_channel/user_not_found🤖 Generated with Claude Code