arduino/Arduino · error · TargetPlatformException

No valid hardware definitions found in folder {0}.

Error message

No valid hardware definitions found in folder {0}.

What it means

BaseNoGui throws TargetPlatformException when, after loading a hardware package's folders, no valid platforms were found inside the package. It means the folder layout does not match the expected Arduino hardware hierarchy (e.g. missing <architecture> subfolders with boards.txt/platform.txt).

Source

Thrown at arduino-core/src/processing/app/BaseNoGui.java:610

    if (folders == null) {
      return;
    }

    for (File subFolder : folders) {
      if (!subFolder.exists() || !subFolder.canRead()) {
        continue;
      }
      String arch = subFolder.getName();
      try {
        TargetPlatform p = new LegacyTargetPlatform(arch, subFolder, targetPackage);
        targetPackage.getPlatforms().put(arch, p);
      } catch (TargetPlatformException e) {
        System.err.println(e.getMessage());
      }
    }

    if (targetPackage.getPlatforms().size() == 0) {
      throw new TargetPlatformException(I18n.format(tr("No valid hardware definitions found in folder {0}."), _folder.getName()));
    }
  }

  /**
   * Grab the contents of a file as a string.
   */
  static public String loadFile(File file) throws IOException {
    String[] contents = PApplet.loadStrings(file);
    if (contents == null) return null;
    return PApplet.join(contents, "\n");
  }

  public static void checkInstallationFolder() {
    if (isIDEInstalledIntoSettingsFolder()) {
      showError(tr("Incorrect IDE installation folder"), tr("Your copy of the IDE is installed in a subfolder of your settings folder.\nPlease move the IDE to another folder."), 10);
    }
    if (isIDEInstalledIntoSketchbookFolder()) {
      showError(tr("Incorrect IDE installation folder"), tr("Your copy of the IDE is installed in a subfolder of your sketchbook.\nPlease move the IDE to another folder."), 10);

View on GitHub (pinned to a0df6e0e83)

Solutions

  1. Verify the hardware folder layout: <hardware-path>/<vendor>/<architecture>/{boards.txt,platform.txt} and re-extract the core if wrong
  2. Check the console output just above the error for TargetPlatformException details about the rejected folders
  3. Reinstall/repair the affected core via Boards Manager (or delete and re-download the vendor folder)
  4. Ensure the folder actually contains boards.txt; if this is your own package, add a valid platform.txt/boards.txt pair

Example fix

// before: wrong nesting
hardware/mycore/boards.txt          // missing architecture level
// after: correct nesting
hardware/mycore/avr/boards.txt
hardware/mycore/avr/platform.txt
Defensive patterns

Strategy: validation

Validate before calling

File platform = new File(hwFolder, "<architecture>");
if (!new File(platform, "boards.txt").isFile())
  throw new IllegalStateException("No boards.txt under " + hwFolder + " — wrong folder layout");

Try / catch

try {
  BaseNoGui.loadHardware(hwFolder);
} catch (TargetPlatformException e) {
  System.err.println("Reinstall the core: " + e.getMessage());
}

Prevention

When it happens

Trigger: loadHardware() processes a folder under the hardware directory; all subfolder load attempts either failed (TargetPlatformException caught and printed) or yielded zero entries in targetPackage.getPlatforms().

Common situations: Manually downloading a core and extracting one level too deep or too shallow; renaming architecture folders; a boards.txt missing from the platform folder; corrupt/incomplete IDE installation.

Related errors


AI-assisted analysis of arduino/Arduino@a0df6e0e83 (2026-09-06). Data as JSON: /api/errors/e3546f9b1f5aa872. Report an issue: GitHub.