Component: finbot/agents/chat.py → VendorChatAssistant._call_start_workflow (line 229)
Root cause:
# chat.py line 229
summary=f"Chat workflow started: {description[:100]}",
description is a required string parameter with no None guard. When the LLM omits
the field or sends null, description=None reaches line 229 where None[:100] raises
TypeError: 'NoneType' object is not subscriptable. This exception is unhandled —
it propagates out of the method as a 500-class error.
Steps to reproduce:
- Create a
VendorChatAssistant with a mock background_tasks.
- Call
_call_start_workflow(None, vendor_id=1).
Expected: {"error": "description is required"} — clean error JSON
Actual: TypeError: 'NoneType' object is not subscriptable — unhandled exception
How to execute:
pytest tests/unit/agents/test_chat_assistant.py::TestBoundaryAndTypeValues::test_chat_boundary_012_description_none_crashes_before_dispatch -v
Proposed fix:
if not description and description is not None:
pass # empty string allowed — validated separately
if description is None:
return json.dumps({"error": "description is required"})
Or add a guard at the top of the method alongside the background_tasks check:
if description is None or vendor_id is None:
return json.dumps({"error": "description and vendor_id are required"})
Impact: Any LLM tool call that omits description causes an unhandled exception.
The background task is never enqueued. The caller receives no structured error —
just an uncaught TypeError propagating up the call stack, which at the FastAPI layer
becomes a 500 response. The crash happens after background_tasks.add_task has already
been called (line 208), so the workflow ID may have been allocated but never properly
tracked.
Note: This and TICKET 9 share the same fix location. They should be resolved together.
Acceptance criteria:
test_chat_boundary_012_description_none_crashes_before_dispatch updated to assert error JSON (once fix is applied)
_call_start_workflow returns {"error": ...} when description is None
- No unhandled
TypeError propagates to the caller
- All other
_call_start_workflow tests continue to pass
Component: finbot/agents/chat.py → VendorChatAssistant._call_start_workflow (line 229)
Root cause:
descriptionis a required string parameter with no None guard. When the LLM omitsthe field or sends
null,description=Nonereaches line 229 whereNone[:100]raisesTypeError: 'NoneType' object is not subscriptable. This exception is unhandled —it propagates out of the method as a 500-class error.
Steps to reproduce:
VendorChatAssistantwith a mockbackground_tasks._call_start_workflow(None, vendor_id=1).Expected:
{"error": "description is required"}— clean error JSONActual:
TypeError: 'NoneType' object is not subscriptable— unhandled exceptionHow to execute:
Proposed fix:
Or add a guard at the top of the method alongside the
background_taskscheck:Impact: Any LLM tool call that omits
descriptioncauses an unhandled exception.The background task is never enqueued. The caller receives no structured error —
just an uncaught
TypeErrorpropagating up the call stack, which at the FastAPI layerbecomes a 500 response. The crash happens after
background_tasks.add_taskhas alreadybeen called (line 208), so the workflow ID may have been allocated but never properly
tracked.
Note: This and TICKET 9 share the same fix location. They should be resolved together.
Acceptance criteria:
test_chat_boundary_012_description_none_crashes_before_dispatchupdated to assert error JSON (once fix is applied)_call_start_workflowreturns{"error": ...}whendescription is NoneTypeErrorpropagates to the caller_call_start_workflowtests continue to pass