๐Ÿ› [Bug] Crash on Qwen3.6-27b: "Cannot read properties of undefined (reading 'startsWith')" in content renderer Description

Open ๐Ÿ’ฌ 0 comments Opened Jun 22, 2026 by kukuxian

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When using the Qwen3.6-27b model, the extension crashes with a rendering error immediately upon receiving or processing specific responses. The error message is:
Error rendering content: Cannot read properties of undefined (reading 'startsWith')
This issue appears to be isolated to this specific model configuration and suggests a lack of defensive programming in the content parser when handling non-standard or empty response fields.
Steps to Reproduce

Hypothesis:
The parser attempts to check if a string starts with a specific prefix (likely related to slash command detection or message role validation).
For Qwen3.6-27b, the API response structure may differ slightly from Anthropic models (e.g., a role or type field might be null/undefined in certain streaming chunks).
The code calls .startsWith() directly on this undefined variable without a null check (?.), causing the crash.
This is similar to previous issues where startsWith("/") logic was too aggressive, but in this case, it seems to be a missing data validation issue rather than a false positive detection issue.
Environment
Extension Version: [2.1.153]
VS Code Version: [1.125.1]
OS: [Linux]
Model: Qwen3.6-27b (via [API Provider Name, e.g., SiliconFlow/Ollama])
Additional Context
This issue does not occur with standard Claude models (Sonnet/Opus).
Clearing local storage and reinstalling the extension did not resolve the issue.
Network logs show successful 200 OK responses from the API, confirming the issue is strictly client-side parsing.
Suggested Fix
Add optional chaining or type checking before calling string methods in the content parser:
`- return $.startsWith(ht);

  • return $?.startsWith(ht) ?? false;`

Or ensure that the upstream data structure guarantees the existence of the field before it reaches the renderer.

What Should Happen?

<img width="739" height="302" alt="Image" src="https://github.com/user-attachments/assets/0a9e5f77-00a6-4022-9ec6-ee8a2ff94b4d" />

Error Messages/Logs

Steps to Reproduce

Open VS Code with the extension installed.
Select Qwen3.6-27b as the active model.
Initiate a conversation (specifically one that might trigger complex formatting or tool use).
Observe that the chat interface crashes and displays the "Something went wrong" overlay.
Expected Behavior
The extension should gracefully handle missing or undefined fields in the model's response stream without crashing. If a field required for parsing (e.g., role, status, or text prefix) is missing, it should default to a safe value or log a warning instead of throwing an unhandled exception.
Actual Behavior
The UI becomes unresponsive, and the following error is shown:
Error rendering content: Cannot read properties of undefined (reading 'startsWith')
Technical Analysis / Root Cause Hypothesis
Based on debugging the minified code, the crash occurs in a function similar to:
function hK1($) {
return $.startsWith(ht); // $ is undefined here
}

Claude Model

Other

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.153

Platform

Other

Operating System

Ubuntu/Debian Linux

Terminal/Shell

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub โ†—