Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

bug: unguarded json.loads on streamed tool-call arguments crashes the request on empty/truncated JSON

Open
#252 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
api, backend

Research direction

Locate the shared extract_json() helper and the streaming argument parsing paths for Anthropic, OpenAI chat completions, OpenAI Responses, plus Anthropic history replay. Trace how empty or truncated payloads currently reach json.loads(), then verify that malformed streaming input produces a descriptive tool-specific error and corrupt history degrades to {} without aborting the request.

Written by the indexing model from the issue text.

Description

bug: unguarded json.loads on streamed tool-call arguments crashes the request on empty/truncated JSON

Bug description

Providers occasionally stream empty or truncated tool-call argument JSON
(e.g. output cut off by token limits or an upstream hiccup). The unguarded
json.loads() on streamed arguments then raises JSONDecodeError, which
surfaces to the user as a raw error and aborts the in-flight step:

Error: Expecting value: line 1 column 1 (char 0)

This is provider-agnostic — any of the streaming providers can emit an empty
or truncated arguments payload.

Expected behavior

A malformed/empty streamed arguments payload should degrade gracefully, not
kill the request.

Suggested approach

Add a shared parse helper that:

  1. Parses strictly,
  2. Falls back to the existing lenient extract_json() helper,
  3. On total failure, raises a descriptive error naming the tool and including a payload snippet (instead of a bare JSONDecodeError).

Apply it to all streaming providers (Anthropic, OpenAI chat completions,
OpenAI Responses) and to Anthropic history replay, where a stale corrupt
payload in history should degrade to {} rather than breaking the current
request.

Environment
  • Latest main

Dominant language
Python
Stars
620
Forks
85
PR merge metrics
No merged PRs in 30d

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from open-webui/computer

All issues in open-webui/computer

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.