-
Notifications
You must be signed in to change notification settings - Fork 113
Description
name: 🐛 Bug Report
about: Create a report to help us improve FireForm.
title: "[BUG]: JsonManager crashes with AttributeError when loading corrupted JSON"
labels: bug
assignees: ''
⚡️ Describe the Bug
The application crashes with AttributeError: module 'json' has no attribute 'DecodeError' when trying to load a corrupted or invalid JSON file. This happens because json_manager.py uses the wrong exception name - json.DecodeError doesn't exist in Python's json module.
👣 Steps to Reproduce
- Create a corrupted JSON file in
src/outputs/ - Try to load it using
JsonManager.load_json() - Application crashes with AttributeError
📉 Expected Behavior
Should catch the JSON parsing error gracefully and raise an IOError with a helpful message like "Invalid JSON format in file."
🖥️ Environment Information
- OS: Windows 11
- Python: 3.11+
- Docker/Compose Version: N/A
- Ollama Model used: N/A (occurs before LLM interaction)
📋 Error Logs
Traceback (most recent call last):
File "src/json_manager.py", line 14, in load_json
except json.DecodeError:
AttributeError: module 'json' has no attribute 'DecodeError'🕵️ Possible Fix
Line 14 in src/json_manager.py needs to use json.JSONDecodeError instead of json.DecodeError. The correct exception name in Python's json module is JSONDecodeError, not DecodeError.
One-line fix:
Change line 14 from except json.DecodeError: to except json.JSONDecodeError: