Arduino error messages, explained
45 error messages, each in the words the Arduino IDE prints. Every page says what it means, why it happens, and shows a broken and a fixed sketch you can run in Mokxi.
- 36 build errors
- 9 upload errors
- Chosen from the failed builds on Mokxi in the 30 days to November 16, 2026
The sketch does not compile so nothing reaches a board
error: 'ledPin' was not declared in this scopeThe compiler reached a name it does not know. It has not been told what ledPin is, so it stops.
Seen 1,904 times in failed builds on Mokxi in the 30 days to November 16, 2026.
error: 'Servo' does not name a typeThe compiler expected a type, such as int, String or Servo, and the word it found is not one it knows.
Seen 725 times in failed builds on Mokxi in the 30 days to November 16, 2026.
fatal error: Servo.h: No such file or directoryThe compiler looked for the file named in an #include line and it is not there.
Seen 673 times in failed builds on Mokxi in the 30 days to November 16, 2026.
multiple definition of 'counter'A name that can be defined only once was defined twice. The compiler reports it as redefinition of when both are in one file, and the linker reports it as multiple definition of when they are in two files.
Seen 354 times in failed builds on Mokxi in the 30 days to November 16, 2026.
error: expected ';' before '}' tokenThe compiler reached the end of a statement and found no semicolon, so it stops at the next token.
Seen 2,761 times in failed builds on Mokxi in the 30 days to November 16, 2026.
error: expected primary-expression before ')' tokenThe compiler needed a value, a name or a number, and found a bracket, a comma or a keyword instead.
Seen 2,761 times in failed builds on Mokxi in the 30 days to November 16, 2026.
error: expected unqualified-id before 'if'Outside a function the compiler expects the name of something new: a variable, a function, a type. It found a statement or a keyword.
Seen 2,761 times in failed builds on Mokxi in the 30 days to November 16, 2026.
error: expected '}' at end of inputThe file ended while a function or block was still open. There are more { than } in the sketch.
Seen 2,761 times in failed builds on Mokxi in the 30 days to November 16, 2026.
error: stray '\342' in programThe code holds a character that is not plain text: a curly quote, a long dash, or a non-breaking space. C++ only reads straight quotes and ordinary spaces.
Seen 2,761 times in failed builds on Mokxi in the 30 days to November 16, 2026.
error: a function-definition is not allowed here before '{' tokenA function can only be defined at the top level of the file. This one sits inside the curly brackets of another function.
Seen 2,761 times in failed builds on Mokxi in the 30 days to November 16, 2026.
error: cannot convert 'String' to 'const char*'An Arduino String is an object. Functions from the C library, such as strlen, strcmp and atoi, want a plain character array, a const char*.
Seen 487 times in failed builds on Mokxi in the 30 days to November 16, 2026.
error: invalid conversion from 'const char*' to 'char*' [-fpermissive]A const char* points at text that must not change. A char* promises that the code may change it. C++ will not let you drop the promise.
Seen 487 times in failed builds on Mokxi in the 30 days to November 16, 2026.
error: no matching function for call to 'digitalWrite(int)'The function exists, but not with the arguments you gave it. There are too few, too many, or one is the wrong type.
Seen 487 times in failed builds on Mokxi in the 30 days to November 16, 2026.
error: invalid types 'int[int]' for array subscriptSquare brackets pick one item out of an array. The name in front of them is not an array, or the number inside is not a whole number.
Seen 487 times in failed builds on Mokxi in the 30 days to November 16, 2026.
error: call of overloaded 'show(double)' is ambiguousTwo functions share a name and take different types. The value you passed fits both equally, so the compiler will not guess.
Seen 487 times in failed builds on Mokxi in the 30 days to November 16, 2026.
error: lvalue required as left operand of assignmentAn assignment needs a place to store the value on its left: a variable. The left side was something else, such as a number, a constant or a calculation.
Seen 487 times in failed builds on Mokxi in the 30 days to November 16, 2026.
error: 'class HardwareSerial' has no member named 'printn'The name after the dot is not a function or a field of that object. It is misspelled, it belongs to another class, or the library version has no such call.
Seen 290 times in failed builds on Mokxi in the 30 days to November 16, 2026.
undefined reference to `readSensor()'The code compiled. The linker, which joins the pieces, could not find the body of a function that your code calls.
Seen 165 times in failed builds on Mokxi in the 30 days to November 16, 2026.
undefined reference to `setup'Every sketch needs a void setup() and a void loop(). The Arduino code that starts your program calls both by name.
Seen 754 times in failed builds on Mokxi in the 30 days to November 16, 2026.
error: 'Serial1' was not declared in this scopeAn Arduino Uno or Nano has one hardware serial port, called Serial, shared with the USB cable. Serial1, Serial2 and Serial3 exist on bigger boards only.
Seen 1,904 times in failed builds on Mokxi in the 30 days to November 16, 2026.
text section exceeds available space in boardThe compiled program has to fit in flash memory. An Uno has 32,256 bytes for your sketch. This one needs more.
Seen 26 times in failed builds on Mokxi in the 30 days to November 16, 2026.
Global variables use 2400 bytes (117%) of dynamic memoryRAM holds your variables while the sketch runs. An Uno has 2,048 bytes of it. The global variables alone are bigger than that.
Seen 30 times in failed builds on Mokxi in the 30 days to November 16, 2026.
fatal error: stm32f4xx.h: No such file or directorystm32f4xx.h and the stm32f4xx_hal headers belong to ST's HAL, the library that STM32CubeIDE projects call. They exist on STM32 F4 boards only.
fatal error: esp_camera.h: No such file or directoryesp_camera.h is the camera driver of the ESP32 board package. It exists for ESP32 boards, such as the ESP32-CAM, and for nothing else.
fatal error: WiFi.h: No such file or directoryWiFi.h is the WiFi library of boards that have a radio: the ESP32 family, the Pico W and the Uno R4 WiFi.
fatal error: BlynkSimpleEsp8266.h: No such file or directoryBlynkSimpleEsp8266.h is the part of the Blynk library for an ESP8266 board. It needs the Blynk library installed and an ESP8266 board chosen.
fatal error: Audio.h: No such file or directoryAudio.h is not part of Arduino itself. Sketches that play web radio or MP3 on an ESP32 include it from the ESP32-audioI2S library.
fatal error: espnow.h: No such file or directoryESP-NOW sends small packets between ESP boards with no router. Its header is espnow.h on an ESP8266 and esp_now.h on an ESP32.
fatal error: USBHIDKeyboard.h: No such file or directoryUSBHIDKeyboard.h is the keyboard library of the ESP32-S2 and ESP32-S3, which can be a USB device.
error: void value not ignored as it ought to beA function declared void gives nothing back. The code tried to store or test what it returned.
Seen 487 times in failed builds on Mokxi in the 30 days to November 16, 2026.
error: ISO C++ forbids comparison between pointer and integer [-fpermissive]A piece of text, a char array or a string literal, is a pointer. A single character or a number is an integer. They cannot be compared with ==.
Seen 487 times in failed builds on Mokxi in the 30 days to November 16, 2026.
error: too many arguments to function 'void blink()'The call passes more values than the function declares. Count the parameters in the function and the values in the call.
Seen 487 times in failed builds on Mokxi in the 30 days to November 16, 2026.
error: jump to case label [-fpermissive]All cases of a switch share one block. A variable made inside one case would exist, unset, when another case runs. C++ refuses that.
Seen 2,761 times in failed builds on Mokxi in the 30 days to November 16, 2026.
error: 'led' redeclared as different kind of symbolA name can mean one thing at a time. The sketch uses it for a variable and for a function, or for a variable and a name the Arduino core already uses.
Seen 354 times in failed builds on Mokxi in the 30 days to November 16, 2026.
error: invalid operands of types 'const char [6]' and 'const char [6]' to binary 'operator+'An operator such as + or % was used on types it does not support. Two quoted texts cannot be added. A decimal number has no remainder.
Seen 487 times in failed builds on Mokxi in the 30 days to November 16, 2026.
error: too many initializers for 'int [3]'The array was declared with room for a number of items and the braces hold more. Text arrays have the same limit, and the text needs one extra place for its end mark.
Seen 487 times in failed builds on Mokxi in the 30 days to November 16, 2026.
The sketch compiles and the board does not take it
Mokxi runs your sketch in the browser and never uploads, so it does not raise these. The pages give advice for a real board and a way to check the code first.
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00Your sketch compiled. This message comes after that, when the computer tries to send the program to the board and the board does not answer.
Port not foundThe Arduino IDE has no port to send the sketch to. The computer does not list your board as a serial port.
A fatal error occurred: Failed to connect to ESP32: Wrong boot mode detected (0x13)! The chip needs to be in download mode.To take a new program, the ESP32 has to start in download mode. The upload tool resets the chip and finds it running a program instead.
A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet headerThe upload tool sent its request and the chip said nothing back. The line of dots and underscores in the output is it trying again and again.
avrdude: stk500v2_getsync(): timeout communicating with programmerThe Mega 2560 uses a different upload protocol from the Uno, called stk500v2. This message is the Mega version of "not in sync".
avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission deniedavrdude could not open the serial port at all, before it talked to the board. Permission denied, Access is denied and Resource busy are three versions of the same problem.
avrdude: butterfly_recv(): programmer is not respondingThe Leonardo, the Micro and the Pro Micro use their own USB chip, and the upload starts by a reset into the bootloader. This message means the tool missed it.
No accessible RP2040 devices in BOOTSEL mode were found.A Raspberry Pi Pico takes a new program when it starts in BOOTSEL mode, where it shows up as a drive called RPI-RP2. The upload tool found no Pico in that mode.
error: espcomm_upload_mem failedThe upload tool could not sync with the ESP8266. It tried to open the port, found no answer, and gave up.
Not on the list? Paste the error into Mokxi
Mokxi’s build tab explains the first error of a failed build in plain words and, for many mistakes, fixes it with one button. The longer guides cover every error on this page and more.