Skip to content

Cannot convert argument to a ByteString error when using DeepSeek V4 model with Chinese characters in response #236

Description

@karssaa

Environment:

VS Code version: 1.133.0
Extension version: 0.7.1
OS: macOS
Model: DeepSeek V4 / deepseek-chat

Error message:
Sorry, your request failed. Please try again.
Client Request Id: 337ab717-107d-40bb-a76e-fc837d0d10ce
Reason: Cannot convert argument to a ByteString because the character at index 22
has a value of 26412 which is greater than 255.

Root cause (technical):

Character code 26412 is the Chinese character 码. The error indicates that somewhere in the extension's request/response processing pipeline, a string is being converted to bytes using a single-byte encoding (such as latin-1 or ascii) instead of UTF-8.

This encoding expects values 0–255 only, so any multi-byte Unicode character (CJK, emoji, etc.) causes the conversion to fail.

Steps to reproduce:

Configure DeepSeek V4 as the model provider
Send a prompt that causes the model to respond in Chinese (or include Chinese content)
Error appears immediately
Expected behavior:
Response containing Chinese / non-ASCII characters should be handled correctly using UTF-8 encoding.

Workaround:
Using English-only prompts avoids triggering the error. Calling the DeepSeek API directly via the openai Python SDK works fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions