Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Crash when tool is missing from tool_status app config #34

@julien-nc

Description

@julien-nc

Running the app from the main branch, I get

2025-06-13 13:00:31,374 - context_agent - ERROR - Error: Traceback (most recent call last):                                                                                                   
  File "/.../context_agent/ex_app/lib/main.py", line 142, in background_thread_task                                                                  
    output = react(task, nextcloud)                                                                                                                                                           
  File "/.../context_agent/ex_app/lib/agent.py", line 48, in react                                                                                                            
    safe_tools, dangerous_tools = get_tools(nc)                                                                                                                                               
                                  ~~~~~~~~~^^^^                                                                                                                                               
  File "/.../context_agent/ex_app/lib/all_tools/lib/decorator.py", line 33, in wrapper                                                                  
    result = func(*args)                                                                                                                                                                      
  File "/.../context_agent/ex_app/lib/tools.py", line 32, in get_tools                                                                                                        
    if not is_activated[module_name]:                                                                                                                                                         
           ~~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: 'image_gen'

when sending a message in the chat.
If fixed it by changing line 31 of tools.py by:

if module_name in is_activated and not is_activated[module_name]:

So a tool is considered activated if it's not part of the is_activated list.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions