HKUDS/Vibe-Trading · warning · ValueError
Slack target channel name is empty
Error message
Slack target channel name is empty
What it means
Target resolution failed because the channel name, after normalization (strip, remove leading #/@, lowercase), is empty.
Source
Thrown at agent/src/channels/slack.py:232
if self._SLACK_ID_RE.fullmatch(target):
if target.startswith(("U", "W")):
return await self._open_dm_for_user(target)
return target
if target.startswith("#"):
return await self._resolve_channel_name(target[1:])
if target.startswith("@"):
return await self._resolve_user_handle(target[1:])
try:
return await self._resolve_channel_name(target)
except ValueError:
return await self._resolve_user_handle(target)
async def _resolve_channel_name(self, name: str) -> str:
normalized = self._normalize_target_name(name)
if not normalized:
raise ValueError("Slack target channel name is empty")
cache_key = f"channel:{normalized}"
if cache_key in self._target_cache:
return self._target_cache[cache_key]
cursor: str | None = None
while True:
response = await self._web_client.conversations_list(
types="public_channel,private_channel",
exclude_archived=True,
limit=200,
cursor=cursor,
)
for channel in response.get("channels", []):
if self._normalize_target_name(str(channel.get("name") or "")) == normalized:
channel_id = str(channel.get("id") or "")
if channel_id:
self._target_cache[cache_key] = channel_idView on GitHub (pinned to 80ffdda44c)
Solutions
- Pass a real channel name or ID, e.g. '#general' or 'C0123456789'
- Validate user-supplied targets before sending
- Check templating that produces empty channel names
Example fix
# before
await slack.send('#', ...)
# after
await slack.send('#general', ...) Defensive patterns
Strategy: validation
Validate before calling
if not target.strip().strip('#@'):
raise ValueError('empty Slack target') Type guard
def is_valid_slack_target(t: str) -> bool:
return bool(t and t.strip().strip('#@')) Try / catch
except ValueError as e:
if 'name is empty' in str(e):
reject_user_input('invalid channel target') Prevention
- Validate user-entered targets before dispatch
- Fail loudly on un-interpolated templates
When it happens
Trigger: Calling send()/target resolution with a target of '#', '@', whitespace, or an empty string.
Common situations: User input like '#' passed through, or config placeholder values such as '#{{channel}}' not being interpolated.
Related errors
- Slack target user handle is empty
- invalid alpha_id
- alpha_id not found
- invalid period: {exc}
- too many running benches; wait for one to finish
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/f7fe33477324a6db.
Report an issue: GitHub.