-
Notifications
You must be signed in to change notification settings - Fork 33.5k
[Bug]: Unchecked str.split() index access can raise IndexError #2745
Copy link
Copy link
Closed
Labels
P3Low — cosmetic, nice to haveLow — cosmetic, nice to havecomp/agentCore agent loop, run_agent.py, prompt builderCore agent loop, run_agent.py, prompt buildercomp/gatewayGateway runner, session dispatch, deliveryGateway runner, session dispatch, deliverycomp/toolsTool registry, model_tools, toolsetsTool registry, model_tools, toolsetsplatform/slackSlack app adapterSlack app adaptertype/bugSomething isn't workingSomething isn't working
Metadata
Metadata
Assignees
Labels
P3Low — cosmetic, nice to haveLow — cosmetic, nice to havecomp/agentCore agent loop, run_agent.py, prompt builderCore agent loop, run_agent.py, prompt buildercomp/gatewayGateway runner, session dispatch, deliveryGateway runner, session dispatch, deliverycomp/toolsTool registry, model_tools, toolsetsTool registry, model_tools, toolsetsplatform/slackSlack app adapterSlack app adaptertype/bugSomething isn't workingSomething isn't working
Type
Fields
Give feedbackNo fields configured for issues without a type.
Description
Multiple locations access
str.split()[0]without guarding against the case wheresplit()returns an empty list (e.g., whitespace-only or empty strings). This causes an unhandledIndexError.Affected Files
tools/file_operations.pylinter_cmd.split()[0]gateway/platforms/slack.pytext.split()[0] if text else ""— doesn't handle whitespace-onlytextagent/anthropic_adapter.pyresult.stdout.strip().split()[0]Steps to Reproduce
file_operations.py: configure a linter command as an empty stringslack.py: send a Slack message with only whitespaceanthropic_adapter.py: haveclaude --versionreturn empty/whitespace outputFix
Guard each
split()[0]with a check that the resulting list is non-empty before indexing.