PlatformIO Community

Pio pkg pack fails with "Error: Invalid manifest fields"

Hi,

I intend to publish a library, but fail to provide a proper library.json manifest.
Tried lots of variants, all failed while I think it conforms to docs. Maybe you can help spot the error?

{
  "name": "Joba_ESmart3",
  "version": "1.0",
  "description": "Talk to an ESmart3 MPPT solar charge controller over RS485",
  "keywords": "pv, solar, charge, battery, mppt, rs485",
  "repository":
  {
    "type": "git",
    "url": "https://github.com/joba-1/Joba_ESmart3.git"
  },
  "authors":
  [
    {
      "name": "Joachim Banzhaf",
      "email": "joachim.banzhaf@gmail.com",
      "url": "https://github.com/joba-1/Joba_ESmart/discussions/",
      "maintainer": true
    }
  ],
  "license": "GPL-2.0-only",
  "homepage": "https://github.com/joba-1/Joba_ESmart/",
  "frameworks": "arduino",
  "platforms": "espressif32"
}

Edit 1: Full error message is this:

Error: Invalid manifest fields: {'examples': {39: {'name': ['Length must be between 1 and 255.']}, 40: {'name': ['Length must be between 1 and 255.']}, 41: {'name': ['Length must be between 1 and 255.']}, 42: {'name': ['Length must be between 1 and 255.']}}}. 
Please check specification -> https://docs.platformio.org/page/librarymanager/config.html

Edit 2: figured this might be helpful:

pio --version
PlatformIO Core, version 6.1.4

FWIW:
I created and successfully published another lib (GitHub - joba-1/Joba_Tsl2561: Arduino/PlatformIO library for Tsl2561 luminosity sensor) several years ago.
I copied the library.json of that old lib to my new lib: same error. Hmm.

No recent library writers around?
Stripped down library.json to just name and version. Still same error.

Interesting, this reads like the “examples” attribute in line 39 are wrong, but the library.json you showed doesn’t even have an examples field. Maybe it tries to auto-generate the missing on and it trips?

CC @ivankravets

2 Likes

Nice, I just gave it an example and that works.
But I’d rather let it auto generate - I think there is nothing special about my examples.

I can’t reproduce this issue using the GitHub - joba-1/Joba_ESmart3: Complete control of eSmart3 MPPT solar charge controllers with ESP32 or ESP8266 via RS485 repository. See

pio pkg publish ~/Downloads/Joba_ESmart3-master/
Preparing a package...
Type:     library
Owner:    ivankravets
Name:     Joba_ESmart3
Version:  3.0
Size:     23.74KB
Are you sure you want to publish the library ivankravets/Joba_ESmart3@3.0 to the registry?
 [y/N]: y
The package publishing may take some time depending on your Internet connection and the package size.
Publishing...
The package has been accepted. We will notify you on email when process it.
1 Like

ok, thank you. I’ll try to reproduce on another pc and try to find the difference…

Are you running the latest version of the PIO core? CLIpio upgrade --dev.

Problem solved :slight_smile:

…but not the mystery:

FWIW I tested with git tag v1.0 because that is what I want to publish first.

  • Couldn’t reproduce on another pc with git clone, pio pkg pack - all fine there.
  • Did a clone in another directory on the first pc - all fine as well
  • Removed all .pio and .vscode in the examples of the problematic repo - all fine now (!)
  • Did another build inside vscode to get new .pio and .vscode → still all fine (?)

Must have been something toxic inside one of those hidden folders - but now I cannot reproduce anymore. If it comes back, I’ll report. Thank you for your support!

(I upgraded to 6.1.4 before reporting, didnt know --dev exists, until just now)

The examples list in VSCode/PIO Home/Libraries looks wrong:

main
main
Readme
Readme
...

would have expected something like

Hello_ESmart3  
LiFePO_ESmart3  
Monitor_ESmart3  
Test_ESmart3

Do I need an explicit examples section in library.json to fix this? A bit hard to test :slight_smile: