ESP32 Wrover index.html GDP Error in sourced command file: Remote communication error

Sorry to join the crowd with these problems. I have read it all (I think).
I try to make a WEB-server. If index.html is embedded in main.cpp then everything works. Debugging and showing the page in a browser comes up as it should.
However when index.html (and CCS, JS script and some image) is placed in the root in separate file then first of all I get a 404 page not found, but also a debugging error.
Zadig int0 is set to WinUSB (v6.1.7600.16385) - but I repeatedly have to reset the USB port to get connection. When this debugging error occurs, it is of cause when this problem is fixed.

.pioinit:11: Error in sourced command file:
Remote communication error. Target disconnected.: No error.

And the usual

image

My platformIO.ini:

[env:esp-wrover-kit]
platform = espressif32
board = esp-wrover-kit
framework = arduino

lib_deps = 
  ESP Async WebServer
  arduino-libraries/Arduino_JSON @ 0.1.0

monitor_speed = 115200
debug_init_break = tbreak setup
debug_speed = 500
build_type = debug
[platformio]
description = WEBserver intro

The WEB-server part of code is shown here:

  // Route for root / web page
  server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
    request->send(SPIFFS, "/index.html", "text/html",false);
  });
  server.serveStatic("/", SPIFFS, "/"); 
  // Start server
  server.begin();

I am getting nuts over this - have tried everything else before coming here. I guess you are my last resort… :joy:

I if you work with SPIFFS you really want these files to be in the data/ directory of the project so that they can get packaged and uploaded to the microcontroller instead of in the project root. Or am I misunderstandnig?

When this error occurs, there should be more information in the Debug Console tab of VSCode. What does it say there?

Is the full project uploaded somewhere for reference?

Hi - you are so fast… are you ever sleeping?
Yes the project loads completely without errors - not a handling or system error. Have even tried on another labtop. And yes the data directory is used.
Yes there are lots of information in the debug window… I have worked a lot more - may I share a snippet of code with you? I cannot read a SPIFFS file, and I think this is the real error - and maybee the subject should change to “cannot read SPIFFS file”
File fily = SPIFFS.open("/index.html",“r”);
if(!fily || fily.isDirectory()){
Serial.println(“− failed to open file for reading”);
}
Serial.println(“− read from file:”);
while(fily.available()){
Serial.write(file.read());
}

This code gets succesfully to this line: Serial.println(“− read from file:”);
and no more. It ends here.

Just post the project in a github repo for download.

Wow - never tried this - had to learn something. You only learn by doing mistakes.
I build my own SPIFF-test routine and I think I will improve on it - correct my mistakes.
However in this case I only learned that I had to reinstall VS-code, Python, platformIO and start all over from scratch. And I spend over 40 hours on this.
I don’t know - I think this is not a relevant issue for platformIO. I would recommend to remove it :joy: