SemanticVersionError: Invalid simple spec

I accidentally edited the source file in a library so I assumed I could delete the library and then reinstall it. However, I now get the error:

`SemanticVersionError: Invalid simple spec: ‘^0.0.0-alpha+sha.39f236ea18’

I’ve tried deleting the .pio folder but still get the error.

What does the error mean and how do I fix it?

Ususally editing a source file should not result in such error.
There must be something else.

Please show the content of your platformio.ini to have at least a starting point.

[env:uno]
platform = atmelavr
board = megaatmega2560
framework = arduino
monitor_speed = 9600
lib_deps =
milesburton/DallasTemperature@^3.11.0
contrem/arduino-timer@^3.0.1
andrewrapp/XBee @ ^0.0.0-alpha+sha.39f236ea18
upload_protocol = usbtiny
upload_flags = -e

The output is:

Resolving uno dependencies...
Removing unused dependencies...
SemanticVersionError: Invalid simple spec: '^0.0.0-alpha+sha.39f236ea18'

I created another project and copied the source files across and it works fine. There’s no obvious differences between the two .ini files.

Ok, this is the root cause.

That library seems to use an invalid semantic versioning.
Please remove the version like so:

lib_deps =
  milesburton/DallasTemperature@^3.11.0
  contrem/arduino-timer@^3.0.1
  andrewrapp/XBee

Afaik PlatformIO only accepts versions like <MAJOR>.<MINOR>.<PATCH>

So the working version had:

andrewrapp/XBee@^0.0.0-alpha+sha.39f236ea18

I closed it and re-opened it (trying to fix a problem with the UI) and it now says:

andrewrapp/XBee@0.0.0-alpha+sha.39f236ea18

which also works. Note the missing ‘^’ in the 2nd version. I’m not editing these files. These changes are all done by the IDE.

I went back to the non-working version and edited the .ini file to make that line the same as the working version. It still complains:

So I edited it again so that it was what you suggested:

As you can see, it adds the problematic version info and then gives an error.

The library does not have correct semantic versioning, which is used by Platformio.
Delete the folder .pio/libdeps
In platformio.inichange the lib_deps to andrewrapp/XBee
After saving the platformio.ini the library should be reinstalled correctly.