Skip to content

"Headers not defined" -> This time with logs #12163

@Fmstrat

Description

@Fmstrat

Before submitting your bug report

Relevant environment info

- OS: Linux
- Continue version: v1.2.22
- IDE version: code-server: v4.13.0, Code: 1.78.2
- Model: Qwen3.6
- config:
  
  - name: D Qwen3.6 35B
    provider: openai
    model: unsloth/Qwen3.6-35B-A3B-GGUF:UD-Q4_K_XL
    apiBase: https://desktop.llama.lan
    apiKey: <redacted>
  
Model hosted in `llama.cpp`, though this problem exists with LMS as well.

Description

I receive a "headers not defined" message, which has plagued me (and other users) for a while:

Image

In the past, people have upgraded VScode and it's magically gone away, but it always comes back. It also seems to come and go for me.

A key fact here is a request is never made to the web server hosting the endpoint.

To reproduce

  1. Set up model
  2. Run agent query of test

Log output

Errors from the console:

ERR [Extension Host] [@continuedev] �[31merror�[39m: Headers is not defined {"context":"llm_stream_chat","model":"unsloth/Qwen3.6-35B-A3B-GGUF:UD-Q4_K_XL","provider":"openai","useOpenAIAdapter":true,"streamEnabled":true,"templateMessages":false} log.ts:441:13
[Extension Host] [@continuedev] �[31merror�[39m: Headers is not defined {"context":"llm_stream_chat","model":"unsloth/Qwen3.6-35B-A3B-GGUF:UD-Q4_K_XL","provider":"openai","useOpenAIAdapter":true,"streamEnabled":true,"templateMessages":false} console.ts:137:35
[Extension Host] ReferenceError: Headers is not defined
	at buildHeaders (/home/domainfm/.local/share/code-server/extensions/continue.continue-1.2.22-linux-x64/out/extension.js:209433:29)
	at OpenAI.buildBody (/home/domainfm/.local/share/code-server/extensions/continue.continue-1.2.22-linux-x64/out/extension.js:213335:25)
	at OpenAI.buildRequest (/home/domainfm/.local/share/code-server/extensions/continue.continue-1.2.22-linux-x64/out/extension.js:213292:51)
	at OpenAI.makeRequest (/home/domainfm/.local/share/code-server/extensions/continue.continue-1.2.22-linux-x64/out/extension.js:213117:56)
	at async OpenAIApi.chatCompletionStream (/home/domainfm/.local/share/code-server/extensions/continue.continue-1.2.22-linux-x64/out/extension.js:214099:26)
	at async OpenAI2.openAIAdapterStream (/home/domainfm/.local/share/code-server/extensions/continue.continue-1.2.22-linux-x64/out/extension.js:318552:26)
	at async OpenAI2.streamChat (/home/domainfm/.local/share/code-server/extensions/continue.continue-1.2.22-linux-x64/out/extension.js:318688:32)
	at async llmStreamChat (/home/domainfm/.local/share/code-server/extensions/continue.continue-1.2.22-linux-x64/out/extension.js:819597:19)
	at async handleMessage (/home/domainfm/.local/share/code-server/extensions/continue.continue-1.2.22-linux-x64/out/extension.js:857713:29) console.ts:137:35
  ERR [Extension Host] Error handling webview message: {
  "msg": {
    "messageId": "bbcc47da-a8d4-4654-ab75-59c2dba7c402",
    "messageType": "llm/streamChat",
    "data": {
      "completionOptions": {
        "reasoning": false
      },
      "title": "D Qwen3.6 35B",
      "messages": [
        {
          "role": "system",
          "content": "<important_rules>\n  You are in agent mode.\n\n  If you need to use multiple tools, you can call multiple read-only tools simultaneously.\n\n  Always include the language and file name in the info string when you write code blocks.\n  If you are editing \"src/main.py\" for example, your code block should start with ' src/main.py'\n\n\nFor larger codeblocks (>20 lines), use brief language-appropriate placeholders for unmodified sections, e.g. '// ... existing code ...'\n\nHowever, only output codeblocks for suggestion and demonstration purposes, for example, when enumerating multiple hypothetical options. For implementing changes, use the edit tools.\n\n</important_rules>\n\n<tool_use_instructions>\nYou have access to tools. To call a tool, you MUST respond with EXACTLY the tool code block format shown below.\n\nCRITICAL: Follow the exact syntax. Do not use XML tags, JSON objects, or any other format for tool calls.\n\nThe following tools are available to you:\n\nTo read a file with a known filepath, use the read_file tool. For example, to read a file located at 'path/to/file.txt', you would respond with this:\n\nTOOL_NAME: read_file\nBEGIN_ARG: filepath\npath/to/the_file.txt\nEND_ARG\n\n\nTo create a NEW file, use the create_new_file tool with the relative filepath and new contents. For example, to create a file located at 'path/to/file.txt', you would respond with:\n\nTOOL_NAME: create_new_file\nBEGIN_ARG: filepath\npath/to/the_file.txt\nEND_ARG\nBEGIN_ARG: contents\nContents of the file\nEND_ARG\n\n\nTo run a terminal command, use the run_terminal_command tool\nThe shell is not stateful and will not remember any previous commands.      When a command is run in the background ALWAYS suggest using shell commands to stop it; NEVER suggest using Ctrl+C.      When suggesting subsequent shell commands ALWAYS format them in shell command blocks.      Do NOT perform actions requiring special/admin privileges.      IMPORTANT: To edit files, use Edit/MultiEdit tools instead of bash commands (sed, awk, etc).      Choose terminal commands and scripts optimized for linux and x64 and shell /bin/bash.\nYou can also optionally include the waitForCompletion argument set to false to run the command in the background.      \nFor example, to see the git log, you could respond with:\n\nTOOL_NAME: run_terminal_command\nBEGIN_ARG: command\ngit log\nEND_ARG\n\n\nTo return a list of files based on a glob search pattern, use the file_glob_search tool\n\nTOOL_NAME: file_glob_search\nBEGIN_ARG: pattern\n*.py\nEND_ARG\n\n\nTo view the current git diff, use the view_diff tool. This will show you the changes made in the working directory compared to the last commit.\n\nTOOL_NAME: view_diff\n\n\nTo view the user's currently open file, use the read_currently_open_file tool.\nIf the user is asking about a file and you don't see any code, use this to check the current file\n\nTOOL_NAME: read_currently_open_file\n\n\nTo list files and folders in a given directory, call the ls tool with \"dirPath\" and \"recursive\". For example:\n\nTOOL_NAME: ls\nBEGIN_ARG: dirPath\npath/to/dir\nEND_ARG\nBEGIN_ARG: recursive\nfalse\nEND_ARG\n\n\nTo fetch the content of a URL, use the fetch_url_content tool. For example, to read the contents of a webpage, you might respond with:\n\nTOOL_NAME: fetch_url_content\nBEGIN_ARG: url\nhttps://example.com\nEND_ARG\n\n\nTo edit an EXISTING file, use the edit_existing_file tool with\n- filepath: the relative filepath to the file.\n- changes: Any modifications to the file, showing only needed changes. Do NOT wrap this in a codeblock or write anything besides the code changes. In larger files, use brief language-appropriate placeholders for large unmodified sections, e.g. '// ... existing code ...'\nOnly use this tool if you already know the contents of the file. Otherwise, use the read_file or read_currently_open_file tool to read it first.\nFor example:\n\nTOOL_NAME: edit_existing_file\nBEGIN_ARG: filepath\npath/to/the_file.ts\nEND_ARG\nBEGIN_ARG: changes\n// ... existing code ...\nfunction subtract(a: number, b: number): number {\n  return a - b;\n}\n// ... rest of code ...\nEND_ARG\n\n\nTo perform exact string replacements in files, use the single_find_and_replace tool with a filepath (relative to the root of the workspace) and the strings to find and replace.\n\n  For example, you could respond with:\n\nTOOL_NAME: single_find_and_replace\nBEGIN_ARG: filepath\npath/to/file.ts\nEND_ARG\nBEGIN_ARG: old_string\nconst oldVariable = 'value'\nEND_ARG\nBEGIN_ARG: new_string\nconst newVariable = 'updated'\nEND_ARG\nBEGIN_ARG: replace_all\nfalse\nEND_ARG\n\n\nAlso, these additional tool definitions show other tools you can call with the same syntax:\n\n\nTOOL_NAME: read_skill\nTOOL_DESCRIPTION:\n\nUse this tool to read the content of a skill by its name. Skills contain detailed instructions for specific tasks. The skill name should match one of the available skills listed below: \n\nTOOL_ARG: skillName (string, required)\nThe name of the skill to read. This should match the name from the available skills.\nEND_ARG\n\n\nFor example, this tool definition:\n\n\nTOOL_NAME: example_tool\nTOOL_ARG: arg_1 (string, required)\nDescription of the first argument\nEND_ARG\nTOOL_ARG: arg_2 (number, optional)\nEND_ARG\n\n\nCan be called like this:\n\n\nTOOL_NAME: example_tool\nBEGIN_ARG: arg_1\nThe value\nof arg 1\nEND_ARG\nBEGIN_ARG: arg_2\n3\nEND_ARG\n\n\nRULES FOR TOOL USE:\n1. To call a tool, output a tool code block using EXACTLY the format shown above.\n2. Always start the code block on a new line.\n3. You can only call ONE tool at a time.\n4. The tool code block MUST be the last thing in your response. Stop immediately after the closing fence.\n5. Do NOT wrap tool calls in XML tags like <tool_call> or <function=...>.\n6. Do NOT use JSON format for tool calls.\n7. Do NOT invent tools that are not listed above.\n8. If the user's request can be addressed with a listed tool, use it rather than guessing.\n9. Do not perform actions with hypothetical files. Use tools to find relevant files.\n</tool_use_instructions>"
        },
        {
          "role": "user",
          "content": "test"
        }
      ],
      "messageOptions": {
        "precompiled": true
      }
    }
  }
}

ReferenceError: Headers is not defined log.ts:441:13
[Extension Host] Error handling webview message: {
  "msg": {
    "messageId": "bbcc47da-a8d4-4654-ab75-59c2dba7c402",
    "messageType": "llm/streamChat",
    "data": {
      "completionOptions": {
        "reasoning": false
      },
      "title": "D Qwen3.6 35B",
      "messages": [
        {
          "role": "system",
          "content": "<important_rules>\n  You are in agent mode.\n\n  If you need to use multiple tools, you can call multiple read-only tools simultaneously.\n\n  Always include the language and file name in the info string when you write code blocks.\n  If you are editing \"src/main.py\" for example, your code block should start with ' src/main.py'\n\n\nFor larger codeblocks (>20 lines), use brief language-appropriate placeholders for unmodified sections, e.g. '// ... existing code ...'\n\nHowever, only output codeblocks for suggestion and demonstration purposes, for example, when enumerating multiple hypothetical options. For implementing changes, use the edit tools.\n\n</important_rules>\n\n<tool_use_instructions>\nYou have access to tools. To call a tool, you MUST respond with EXACTLY the tool code block format shown below.\n\nCRITICAL: Follow the exact syntax. Do not use XML tags, JSON objects, or any other format for tool calls.\n\nThe following tools are available to you:\n\nTo read a file with a known filepath, use the read_file tool. For example, to read a file located at 'path/to/file.txt', you would respond with this:\n\nTOOL_NAME: read_file\nBEGIN_ARG: filepath\npath/to/the_file.txt\nEND_ARG\n\n\nTo create a NEW file, use the create_new_file tool with the relative filepath and new contents. For example, to create a file located at 'path/to/file.txt', you would respond with:\n\nTOOL_NAME: create_new_file\nBEGIN_ARG: filepath\npath/to/the_file.txt\nEND_ARG\nBEGIN_ARG: contents\nContents of the file\nEND_ARG\n\n\nTo run a terminal command, use the run_terminal_command tool\nThe shell is not stateful and will not remember any previous commands.      When a command is run in the background ALWAYS suggest using shell commands to stop it; NEVER suggest using Ctrl+C.      When suggesting subsequent shell commands ALWAYS format them in shell command blocks.      Do NOT perform actions requiring special/admin privileges.      IMPORTANT: To edit files, use Edit/MultiEdit tools instead of bash commands (sed, awk, etc).      Choose terminal commands and scripts optimized for linux and x64 and shell /bin/bash.\nYou can also optionally include the waitForCompletion argument set to false to run the command in the background.      \nFor example, to see the git log, you could respond with:\n\nTOOL_NAME: run_terminal_command\nBEGIN_ARG: command\ngit log\nEND_ARG\n\n\nTo return a list of files based on a glob search pattern, use the file_glob_search tool\n\nTOOL_NAME: file_glob_search\nBEGIN_ARG: pattern\n*.py\nEND_ARG\n\n\nTo view the current git diff, use the view_diff tool. This will show you the changes made in the working directory compared to the last commit.\n\nTOOL_NAME: view_diff\n\n\nTo view the user's currently open file, use the read_currently_open_file tool.\nIf the user is asking about a file and you don't see any code, use this to check the current file\n\nTOOL_NAME: read_currently_open_file\n\n\nTo list files and folders in a given directory, call the ls tool with \"dirPath\" and \"recursive\". For example:\n\nTOOL_NAME: ls\nBEGIN_ARG: dirPath\npath/to/dir\nEND_ARG\nBEGIN_ARG: recursive\nfalse\nEND_ARG\n\n\nTo fetch the content of a URL, use the fetch_url_content tool. For example, to read the contents of a webpage, you might respond with:\n\nTOOL_NAME: fetch_url_content\nBEGIN_ARG: url\nhttps://example.com\nEND_ARG\n\n\nTo edit an EXISTING file, use the edit_existing_file tool with\n- filepath: the relative filepath to the file.\n- changes: Any modifications to the file, showing only needed changes. Do NOT wrap this in a codeblock or write anything besides the code changes. In larger files, use brief language-appropriate placeholders for large unmodified sections, e.g. '// ... existing code ...'\nOnly use this tool if you already know the contents of the file. Otherwise, use the read_file or read_currently_open_file tool to read it first.\nFor example:\n\nTOOL_NAME: edit_existing_file\nBEGIN_ARG: filepath\npath/to/the_file.ts\nEND_ARG\nBEGIN_ARG: changes\n// ... existing code ...\nfunction subtract(a: number, b: number): number {\n  return a - b;\n}\n// ... rest of code ...\nEND_ARG\n\n\nTo perform exact string replacements in files, use the single_find_and_replace tool with a filepath (relative to the root of the workspace) and the strings to find and replace.\n\n  For example, you could respond with:\n\nTOOL_NAME: single_find_and_replace\nBEGIN_ARG: filepath\npath/to/file.ts\nEND_ARG\nBEGIN_ARG: old_string\nconst oldVariable = 'value'\nEND_ARG\nBEGIN_ARG: new_string\nconst newVariable = 'updated'\nEND_ARG\nBEGIN_ARG: replace_all\nfalse\nEND_ARG\n\n\nAlso, these additional tool definitions show other tools you can call with the same syntax:\n\n\nTOOL_NAME: read_skill\nTOOL_DESCRIPTION:\n\nUse this tool to read the content of a skill by its name. Skills contain detailed instructions for specific tasks. The skill name should match one of the available skills listed below: \n\nTOOL_ARG: skillName (string, required)\nThe name of the skill to read. This should match the name from the available skills.\nEND_ARG\n\n\nFor example, this tool definition:\n\n\nTOOL_NAME: example_tool\nTOOL_ARG: arg_1 (string, required)\nDescription of the first argument\nEND_ARG\nTOOL_ARG: arg_2 (number, optional)\nEND_ARG\n\n\nCan be called like this:\n\n\nTOOL_NAME: example_tool\nBEGIN_ARG: arg_1\nThe value\nof arg 1\nEND_ARG\nBEGIN_ARG: arg_2\n3\nEND_ARG\n\n\nRULES FOR TOOL USE:\n1. To call a tool, output a tool code block using EXACTLY the format shown above.\n2. Always start the code block on a new line.\n3. You can only call ONE tool at a time.\n4. The tool code block MUST be the last thing in your response. Stop immediately after the closing fence.\n5. Do NOT wrap tool calls in XML tags like <tool_call> or <function=...>.\n6. Do NOT use JSON format for tool calls.\n7. Do NOT invent tools that are not listed above.\n8. If the user's request can be addressed with a listed tool, use it rather than guessing.\n9. Do not perform actions with hypothetical files. Use tools to find relevant files.\n</tool_use_instructions>"
        },
        {
          "role": "user",
          "content": "test"
        }
      ],
      "messageOptions": {
        "precompiled": true
      }
    }
  }
}

ReferenceError: Headers is not defined

Metadata

Metadata

Assignees

No one assigned

    Labels

    ide:vscodeRelates specifically to VS Code extensionkind:bugIndicates an unexpected problem or unintended behavioros:linuxHappening specifically on Linux

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions