Skip to content

[BUG]: Ollama request path lacks timeout and robust error handling #228

@Aryama-srivastav

Description

@Aryama-srivastav

name: 🐛 Bug Report
about: Create a report to help us improve FireForm.
title: "[BUG]: Ollama request path lacks timeout and robust error handling"
labels: bug
assignees: @Aryama-srivastav


⚡️ Describe the Bug

The Ollama call path in backend.py (textToJSON.main_loop) performs requests.post(...) without a timeout and assumes a successful HTTP/JSON response with a response key.
If Ollama is slow, unavailable, returns non-200, or returns malformed JSON, FireForm can hang or fail with unclear exceptions.

👣 Steps to Reproduce

Start FireForm with OLLAMA_HOST pointing to an unavailable endpoint (or stop the Ollama container after startup).
Trigger the PDF fill flow (run_pdf_fill_process(...)).
Observe that the process hangs or crashes with a low-context network/JSON error.
Repeat with a mock endpoint returning HTTP 500 / invalid JSON and see unhandled/unclear failure behavior.

📉 Expected Behavior

Requests to Ollama should fail fast with a bounded timeout.
HTTP errors should be surfaced with clear context (field name + endpoint failure).
Invalid/malformed JSON payloads should return explicit parsing errors.
Missing response key should produce a meaningful exception instead of generic failure.

🖥️ Environment Information

OS: (e.g. Ubuntu 22.04, macOS M2, Windows 11)
Docker/Compose Version: (output of docker --version and docker compose version)
Ollama Model used: (e.g. mistral / Mistral-7B)

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