Skip to content

Fix KeyError when displaying logs for tools without a properties key - #1534

Open
ikatyal2110 wants to merge 1 commit into
simonw:mainfrom
ikatyal2110:fix-logs-tool-schema-missing-properties
Open

Fix KeyError when displaying logs for tools without a properties key#1534
ikatyal2110 wants to merge 1 commit into
simonw:mainfrom
ikatyal2110:fix-logs-tool-schema-missing-properties

Conversation

@ikatyal2110

Copy link
Copy Markdown
Contributor

In llm/cli.py line 2241, logs_list accesses tool["input_schema"]["properties"] when rendering the tool section of llm logs. A plugin can create a Tool instance directly with the default input_schema={} rather than going through Tool.function(), which always adds a "properties" key via Pydantic. Any such tool stored in the database causes llm logs to abort with KeyError: 'properties'. The fix changes the access to tool["input_schema"].get("properties", {}), and a new test reproduces the crash by rewriting a logged tool's schema to omit that key.


Generated by Claude Code

llm logs crashes with KeyError: 'properties' when a tool stored in the
database has an input_schema that does not contain a 'properties' key.
This happens when a plugin creates a Tool instance directly with the
default empty input_schema instead of using Tool.function(), which
always adds 'properties' via Pydantic schema generation. The fix uses
.get('properties', {}) so schemas without that key display correctly.
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.

1 participant