kilocode icon indicating copy to clipboard operation
kilocode copied to clipboard

fetch failed During Indexing Despite Successful External API Test Body

Open TheSecondVibe opened this issue 1 year ago • 9 comments

Description

Hi,

I'm encountering a persistent error when trying to use the Codebase Indexing feature and would appreciate your help. The process fails immediately with the error: Error - Failed during initial scan: fetch failed.

I believe this may be an issue isolated within the extension's environment, as I have performed extensive troubleshooting and have confirmed that my local machine can successfully connect to the OpenAI API using the exact same credentials.

Symptoms:

  • When I click "Start Indexing," the process fails almost instantly.
  • The error message displayed is Error - Failed during initial scan: fetch failed.
  • This happens with both the text-embedding-3-small and text-embedding-3-large models.

Troubleshooting Steps Performed:

  1. Generated a new OpenAI API key with full ("All") permissions to rule out any permission issues.
  2. Restarted the code editor (VS Code) and my entire computer multiple times.
  3. Switched to a different network (my phone's hotspot) to eliminate my local network/router as the cause.
  4. Confirmed I have no active system-wide proxies, VPNs, or firewalls that would block the connection.
  5. Completely uninstalled and reinstalled the Kilo Code extension.
  6. Confirmed my system clock is set to update automatically.
  7. Flushed my system's DNS cache.

Key Diagnostic Finding:

To isolate the problem, I created a simple Node.js script (fetch request to https://api.openai.com/v1/embeddings) and ran it directly from my machine's terminal.

This external script works perfectly. It successfully connects to the OpenAI API and receives a valid response using the exact same API key.

This result strongly suggests that my network, API key, and general system environment are all configured correctly, and that the fetch failed error is occurring specifically within the context or environment where the Kilo Code extension is executing its network requests.

System Environment:

Operating System: macOS Sequoia 15.5 Code Editor & Version: Visual Studio 1.102.3 & Cursor 1.3.9 Machine: 2021 MacBook Pro 16-inch, M1 Chip, 16GB Memory

Thank you for looking into this.

TheSecondVibe avatar Aug 03 '25 07:08 TheSecondVibe

Yep I'm having the exact same problem and it's consistently reproducible.

System Environment:

Operating System: macOS Sequoia 15.5 Code Editor & Version: 1.102.3

reverend333 avatar Aug 04 '25 21:08 reverend333

Hi team, just wanted to provide a quick follow-up with some more diagnostic information on this issue.

To further isolate the problem, I've performed two more tests:

  1. Tested in a Different IDE: I installed the Kilo extension on a completely different IDE, Cursor. I'm getting the exact same fetch failed error there as well.

  2. Updated macOS: I have since updated my operating system to macOS Sequoia 15.6, and the problem still persists.

The fact that the error occurs across different IDEs and macOS versions, combined with my previous successful node.js script test, strongly suggests the issue is within the extension's networking logic itself and not related to a specific editor configuration or OS version.

I noticed user mmiinnovations also reported the same reproducible issue on a similar environment, which further indicates this may be a bug.

Thanks for your attention to this. I'm happy to help test any potential fixes or provide more info if needed.

TheSecondVibe avatar Aug 05 '25 01:08 TheSecondVibe

Hello again,

I have a significant update that I believe pinpoints the exact origin of the error. I managed to capture the output from the VS Code Developer Tools console during the failure.

The logs confirm that all network requests are failing with the same underlying error. The stack trace consistently points to a problem originating deep within Node.js's internal networking engine, undici.

Here is the redacted screenshot of the console at the moment of failure:

Image

This seems to be the definitive proof that the issue is a fundamental incompatibility or sandboxing problem between the undici-based fetch in the VS Code Extension Host environment and the networking layer on macOS Sequoia.

Hopefully, this is the final clue needed to get this resolved. Thank you for your attention to this issue.

TheSecondVibe avatar Aug 05 '25 05:08 TheSecondVibe

Hello again,

I have a final, conclusive update. The root cause of the fetch failed error has been identified, and it is not specific to Kilo Code.

To test a theory, I installed the AI coding extension, Roo-Code.

I was able to reproduce the exact same fetch failed error, with the exact same stack trace pointing to undici, when trying to use the codebase indexing feature on Roo-Code.

TheSecondVibe avatar Aug 06 '25 01:08 TheSecondVibe

I've also encountered the same error. I'm on a MacBook Pro M1, macOS and Cursor.

Image

maciej-trebacz avatar Aug 06 '25 08:08 maciej-trebacz

Okay I just realized that Qdrant needs to be running for this feature to work. The UI didn't seem like this was a required step, I've learned about this by reading the docs. I guess what could be improved is to better indicate in the UI that this step is required plus a better error message.

maciej-trebacz avatar Aug 06 '25 09:08 maciej-trebacz

  1. Qdrant needs to be running.
  2. the port for it is not 6334 its 6333
  3. go to http://localhost:6333/dashboard - and setup api key to input in the settings
  4. safe vector size is 1024 and 512 not 1.5k like the default suggest. especially with local ollama.
  5. you should have it working by now!

VenomekPL avatar Aug 10 '25 20:08 VenomekPL

Hi all! Since this is resolved by running qdrant I will close the issue but I started a discussion on how to improve the UI for this!

kevinvandijk avatar Aug 14 '25 12:08 kevinvandijk

I experienced this exact error on Kilo Code 15.6.1 Codium plugin (mac OS remote server, qdrant (docker, not npm installed)) while changing embedding model providers. In some cases, the issue can be resolved by importing backed up kilo-code-settings. Noting this here because this fix was merged on 2025-08-14, but the bug is still live in this plugin version, released on 2026-05-08.

n-shamsi avatar Jun 27 '26 16:06 n-shamsi