Skip to content

[BUG]: JsonManager crashes with AttributeError when loading corrupted JSON #237

@ishansurdi

Description

@ishansurdi

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

  1. Create a corrupted JSON file in src/outputs/
  2. Try to load it using JsonManager.load_json()
  3. 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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions