Index out of range error when syncing recipe with no version found #732
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
To reproduce:
You need a recipe that does not have any correctly setup versions. I encountered this when trying to setup my new
kiwixrecipe. Then, runabra recipe sync kiwix. The console result is:The problem
The failure occurs in the line
latestRelease := tags[len(tags)-1]with the specified index being-1. This means thatlen(tags)must be0.The proximate solution is that there should be some check immediately before that to assert that there are tags.
However, note that there is code that is intended to handle this case on line 80.
if len(tags) == 0 && nextTag == "" {. While this if statement doesn't wrap the failing code on like 137, it should output a warning in the case of no tags. Perhaps len(tags) is zero and yet nextTag is not ""?@jade How sure are you of the root cause? I saw that you fixed kiwix somehow so I tried on another new recipe that never had a release before (https://recipes.coopcloud.tech/shlink) and I think the line
latestRecipeVersion := versions[len(versions)-1]is the error instead oflatestRelease := tags[len(tags)-1]Note that relying on the line number in the error is not accurate because the code changes, if you haven't changed the abra version you are running maybe you can share the output of
abra --versionand we can make sure whether it is an emty tag or version list for your caseworking on this in #738
#738