{"record":{"id":"3462958d4d7a509c","repo":"arduino/Arduino","slug":"no-headers-files-h-found-in-0","errorCode":null,"errorMessage":"no headers files (.h) found in {0}","messagePattern":"no headers files \\(\\.h\\) found in (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"arduino-core/src/cc/arduino/contributions/libraries/LibrariesIndexer.java","lineNumber":219,"sourceCode":"\n      try {\n        scanLibrary(new UserLibraryFolder(subfolder, folderDesc.location));\n      } catch (IOException e) {\n        System.out.println(I18n.format(tr(\"Invalid library found in {0}: {1}\"), subfolder, e.getMessage()));\n      }\n    }\n  }\n\n  private void scanLibrary(UserLibraryFolder folderDesc) throws IOException {\n    // A library is considered \"legacy\" if it doesn't contains\n    // a file called \"library.properties\"\n    File check = new File(folderDesc.folder, \"library.properties\");\n    if (!check.exists() || !check.isFile()) {\n      // Create a legacy library and exit\n      LegacyUserLibrary lib = LegacyUserLibrary.create(folderDesc);\n      String[] headers = BaseNoGui.headerListFromIncludePath(lib.getSrcFolder());\n      if (headers.length == 0) {\n        throw new IOException(format(tr(\"no headers files (.h) found in {0}\"), lib.getSrcFolder()));\n      }\n      addToInstalledLibraries(lib);\n      return;\n    }\n\n    // Create a regular library\n    UserLibrary lib = UserLibrary.create(folderDesc);\n    String[] headers = BaseNoGui.headerListFromIncludePath(lib.getSrcFolder());\n    if (headers.length == 0) {\n      throw new IOException(format(tr(\"no headers files (.h) found in {0}\"), lib.getSrcFolder()));\n    }\n    addToInstalledLibraries(lib);\n\n    Location loc = lib.getLocation();\n    if (loc != Location.CORE && loc != Location.REFERENCED_CORE) {\n      // Check if we can find the same library in the index\n      // and mark it as installed\n      ContributedLibrary foundLib = index.find(lib.getName(), lib.getVersion());","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/arduino/Arduino/blob/a0df6e0e83b652c72bc78b0a1376c54d6ebc3bee/arduino-core/src/cc/arduino/contributions/libraries/LibrariesIndexer.java#L201-L237","documentation":"LibrariesIndexer.scanLibrary() treats a folder without library.properties as a legacy (1.0-format) library and derives its source folder; BaseNoGui.headerListFromIncludePath() must then find at least one .h file. If none exist, an IOException is thrown because the folder is not a usable legacy library.","triggerScenarios":"scanLibrary() encounters an installed-library folder whose 'library.properties' is missing or not a regular file, and the derived src folder contains zero .h header files.","commonSituations":"A user manually copied a folder containing only sources with extensions other than .h (or only .cpp/.hpp) into the libraries directory; an empty or junk folder inside ~/Arduino/libraries; a library zip extracted with an extra nesting level so headers aren't where the layout expects.","solutions":["Add a library.properties file so the folder is treated as a modern library with explicit layout, or place at least one .h file in the legacy root/src folder.","Remove the offending folder from the libraries directory if it is not actually a library.","Reinstall the library properly via Library Manager so the layout matches the expected format.","Check extraction nesting: headers must be directly in the library root (legacy) or in the src folder declared by library.properties."],"exampleFix":"// before (broken legacy library)\nlibraries/MyLib/MyLib.cpp   // no .h anywhere\n// after\nlibraries/MyLib/MyLib.h     // header present, or add library.properties + src/MyLib.h","handlingStrategy":"validation","validationCode":"File dir = libraryFolder;\nboolean hasProps = new File(dir, \"library.properties\").isFile();\nif (!hasProps && BaseNoGui.headerListFromIncludePath(dir).length == 0) {\n  throw new IllegalStateException(\"Not a valid legacy library: no .h in \" + dir);\n}","typeGuard":null,"tryCatchPattern":"try { indexer.scanInstalledLibraries(); } catch (IOException e) { if (e.getMessage().contains(\"no headers files\")) { skipOrRemoveInvalidLibrary(e); } else { throw e; } }","preventionTips":["Install libraries only through Library Manager.","Verify a folder has headers or library.properties before dropping it into the libraries directory.","Check zip extraction nesting after manual installs."],"tags":["arduino","libraries","validation","filesystem"],"backgroundTag":"file-not-found","analyzedSha":"a0df6e0e83b652c72bc78b0a1376c54d6ebc3bee","analyzedAt":"2026-09-06T10:13:38.901Z","contentChangedAt":"2026-09-06T10:13:38.901Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}