Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#252 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
api, backend

Direzione di ricerca

Individua l’helper condiviso extract_json() e i percorsi di analisi degli argomenti in streaming per Anthropic, OpenAI chat completions, OpenAI Responses e la riproduzione della cronologia Anthropic. Traccia il modo in cui i payload vuoti o troncati raggiungono attualmente json.loads(), quindi verifica che un input di streaming non valido produca un errore descrittivo specifico dello strumento e che una cronologia corrotta venga degradata a {} senza interrompere la richiesta.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
Python
Stelle
667
Fork
96
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di open-webui/computer

Tutte le issue di open-webui/computer

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.