model returning `None` instead of response string
- Dominant language
- Python
- Stars
- 440
- Forks
- 48
- Avg merge
- 28m
- Merged PRs (30d)
- 1
Description
`TypeError: object of type 'NoneType' has no len()`
The traceback points to:
`print(f"[Bridge] Received AI response (len={len(response)})")`
The model is returning `None` instead of a model response string. The logging statement tried to call len(None), which caused the exception. This happened in about 50% of the runs.
Adding error handling on that code would prevent the exception, but it wouldn't fix the root issue. I'll look into the underlying cause of the `None` response. It could be due to an API failure/timeout or some other upstream failure.
The `NoneType` error:
```[Custom API] Generating response using model: openai/gpt-oss-120b
ERROR:ollama-ghidra-bridge:❌ Error in agentic query processing: object of type 'NoneType' has no len()
ERROR:ollama-ghidra-bridge:Full traceback: Traceback (most recent call last):
File "/home/tenzing1/OGhidra/src/bridge.py", line 1998, in process_query_with_agentic_loop
exec_results = self._execution_loop(plan_response, max_steps=max_exec_steps)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/tenzing1/OGhidra/src/bridge.py", line 2849, in _execution_loop
print(f"[Bridge] Received AI response (len={len(response)})")
^^^^^^^^^^^^^
TypeError: object of type 'NoneType' has no len()
=== AI Agent Response ===
Error in query processing: object of type 'NoneType' has no len()
=========================```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in src/bridge.py at _execution_loop around line 2849 and trace how the Custom API response reaches the len(response) log. Reproduce the intermittent None response and inspect the upstream API failure or timeout path. Done means identifying and addressing the cause of None responses, with the logging path no longer failing on a missing response.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ollama, python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100