Skip to content

fix: handleKeyError in slack _get_user_token for unregistered credential#6042

Open
Amdev-5 wants to merge 1 commit intoaden-hive:mainfrom
Amdev-5:fix/slack-user-token-keyerror-6041
Open

fix: handleKeyError in slack _get_user_token for unregistered credential#6042
Amdev-5 wants to merge 1 commit intoaden-hive:mainfrom
Amdev-5:fix/slack-user-token-keyerror-6041

Conversation

@Amdev-5
Copy link
Contributor

@Amdev-5 Amdev-5 commented Mar 8, 2026

#6041

Summary

  • _get_user_token() in slack_tool.py calls credentials.get("slack_user"), but "slack_user" is not registered in
    CREDENTIAL_SPECS (only "slack" is)
  • CredentialStoreAdapter.get() raises KeyError for unregistered credential names, crashing any code path that calls
    _get_user_token() (e.g. slack_search)
  • Added try/except KeyError to gracefully fall back to SLACK_USER_TOKEN env var, matching the existing fallback pattern

Root Cause

CREDENTIAL_SPECS in slack.py only defines "slack" (bot token). The "slack_user" name was never registered, so
credentials.get("slack_user") hits the unknown-name guard in store_adapter.py (line 108-109) and raises KeyError.

Confirmed this pattern is unique to the Slack tool — all other tools only call credentials.get() with registered
credential names.

Fixes #6041

…tial

`credentials.get("slack_user")` raises KeyError because "slack_user"
is not defined in CREDENTIAL_SPECS (only "slack" is registered).
Added try/except to gracefully fall back to SLACK_USER_TOKEN env var.

Fixes aden-hive#6041
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Slack tool crashes with KeyError on "slack_user" credential lookup

1 participant