First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object

I am new to Arduino but I have a school project due tomorrow and my Arduino is not working, it keeps showing this error message: "First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object."

this is my code

const int sensorPin = A0; // Analog pin to read the sensor data
int sensorValue = 0; // Variable to store the sensor value

void setup() {
  pinMode(13, OUTPUT);
}

void loop() {
  // Read the sensor value
  sensorValue = analogRead(sensorPin);
  
  // Convert the sensor value to a percentage
  int waterLevel = map(sensorValue, 0, 1023, 0, 100);
  
  // Display the water level on the Serial Monitor
  Serial.print("Water level: ");
  Serial.print(waterLevel);
  Serial.println("%");
  
  if (waterLevel <= 20){
    digitalWrite(13, HIGH);
  }
  else {
    digitalWrite(13, LOW);
  }
  
  // Wait for 500 milliseconds before reading the sensor again
  delay(500);
}

I have tried everything and it keeps showing this error message. I have used chat GPT to help and it says that the problem must be external so let me try to show you the wiring. It is a water sensor that when low turns on a light.

Water sensor:
S to A0
Positive to 5v
Negative to ground

LED:

Digital 13 to 220-ohm resistor to LED to ground.

Could someone Please help me this is worth a significant percentage of my grade and nobody in my class can help(I don't even think they like me lol)

The sketch compiles with no errors for me.

You forgot to start the serial port in setup()

Serial.begin(9600); // or the bps you want

Regards

It was in there before but I didn't see the use and the error message was still there but I will put it back in

@MaximoEsfuerzo has a good point.

The code compiles fine for me, too. I used the IDE version 1.8.19 board is Uno.

What board are you compiling for? Are you using the IDE? What version?

Please include the entire error message. It is easy to do. If you use the Arduino IDE, there is a button (lower right of the IDE window) called "copy error message". Copy the error and paste into a post in code tags. Paraphrasing the error message leaves out important information.

No problems in Uno/Nano, look

I am using the Arduino Uno r3 board, I do not know what an IDE is but if you mean software then I'm using The Arduino cloud editor app on a chrome book and there is no paraphrasing, that is exactly what the error says

It looks like a JavaScript error.

I am having the same issue on chromebook. Here is the information from the chrome browser console. Any ideas?

TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.
    at vendors~app~vendor.c0f71450d8dbe16fa363.js:38:1612
    at c (vendors~app~vendor.c0f71450d8dbe16fa363.js:38:1712)
    at Function.from (vendors~app~vendor.c0f71450d8dbe16fa363.js:38:6550)
    at m (vendors~app.62e1c80d56a3680784ce.js:18:25482)
    at t.<anonymous> (vendors~app.62e1c80d56a3680784ce.js:18:56758)
    at vendors~app.62e1c80d56a3680784ce.js:18:56177
    at Object.next (vendors~app.62e1c80d56a3680784ce.js:18:56282)
    at s (vendors~app.62e1c80d56a3680784ce.js:18:54978)

I am getting this error even when I am trying to upload the simple blink code from teh example codes given in Arduino's repositories. It is an error in the Web Editor itself. On top of that, Arduino has just 25 compilations for Free users. It is dificult to work on Chromebook. They need to develop Chromebook features.