Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#252 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
api, backend

Hướng nghiên cứu

Xác định helper dùng chung extract_json() và các đường dẫn phân tích đối số streaming cho Anthropic, OpenAI chat completions, OpenAI Responses, cùng với việc phát lại lịch sử Anthropic. Theo dõi cách các payload rỗng hoặc bị cắt ngắn hiện đến được json.loads(), sau đó xác minh rằng dữ liệu đầu vào streaming sai định dạng tạo ra lỗi mô tả rõ ràng dành riêng cho công cụ và lịch sử bị hỏng được chuyển thành {} mà không hủy request.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Python
Star
667
Fork
96
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

  • Có Dockerfile hoặc tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của open-webui/computer

Tất cả issue của open-webui/computer

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.