Catalogue default branch naming issue in abra? #295

Open
opened 2026-02-06 16:33:38 +00:00 by jgaehring · 3 comments

Problem

Similar to #272, I just hit a snag while following the new operator's tut:

~$ abra app new traefik
# FATA unable to update catalogue: failed to select default branch in ~/.abra/catalogue

Updating didn't help (it was already a fairly fresh install of abra), as the troubleshooting page suggested. Removing recipes and pulling also didn't seem like the right fix since this was with the catalogue.

Workaround

I cd'ed into ~/.abra/catalogue and checked the git status, saw I was on branch master with an empty commit log:

~$ cd .abra/catalogue
~/.abra/catalogue$ git status
# On branch master
# 
# No commits yet
# 
# nothing to commit (create/copy files and use "git add" to track)

Made me wonder if master should've been main, and sure nuff, doing a fetch and switch did the trick:

~/.abra/catalogue$ git fetch origin 
# warning: redirecting to https://git.coopcloud.tech/toolshed/recipes-catalogue-json/
# remote: Enumerating objects: 3658, done.
# remote: Counting objects: 100% (3658/3658), done.
# remote: Compressing objects: 100% (3657/3657), done.
# remote: Total 3658 (delta 2409), reused 0 (delta 0), pack-reused 0 (from 0)
# Receiving objects: 100% (3658/3658), 821.47 KiB | 276.00 KiB/s, done.
# Resolving deltas: 100% (2409/2409), done.
# From https://git.coopcloud.tech/coop-cloud/recipes-catalogue-json
#  * [new branch]      main       -> origin/main
~/.abra/catalogue$ git status
# On branch master
# 
# No commits yet
# 
# nothing to commit (create/copy files and use "git add" to track)
~/.abra/catalogue$ git switch main 
# branch 'main' set up to track 'origin/main'.
# Switched to a new branch 'main'
~/.abra/catalogue$ git status
# On branch main
# Your branch is up to date with 'origin/main'.
# 
# nothing to commit, working tree clean
~/.abra/catalogue$ cd ../..
~$ abra app new traefik
# INFO single server detected, choosing ovh_plucky automatically
# ? Specify app domain traefik.ovh_plucky
# INFO traefik.ovh_plucky created (version: 3.10.0+v3.6.7)

Solution

Dunno if updating the Troubleshooting is sufficient or warranted, b/c maybe this was peculiar to me or my git setup or how I installed abra.

It also seems like there may be some internal refs to master that need renaming, too, possibly?

Lemme know if I can give more context. Also, hi friends! 👋

## Problem Similar to #272, I just hit a snag while following the new operator's tut: ```sh ~$ abra app new traefik # FATA unable to update catalogue: failed to select default branch in ~/.abra/catalogue ``` Updating didn't help (it was already a fairly fresh install of abra), as the troubleshooting page suggested. Removing recipes and pulling also didn't seem like the right fix since this was with the catalogue. ## Workaround I cd'ed into ~/.abra/catalogue and checked the git status, saw I was on branch `master` with an empty commit log: ```sh ~$ cd .abra/catalogue ~/.abra/catalogue$ git status # On branch master # # No commits yet # # nothing to commit (create/copy files and use "git add" to track) ``` Made me wonder if `master` should've been `main`, and sure nuff, doing a fetch and switch did the trick: ```sh ~/.abra/catalogue$ git fetch origin # warning: redirecting to https://git.coopcloud.tech/toolshed/recipes-catalogue-json/ # remote: Enumerating objects: 3658, done. # remote: Counting objects: 100% (3658/3658), done. # remote: Compressing objects: 100% (3657/3657), done. # remote: Total 3658 (delta 2409), reused 0 (delta 0), pack-reused 0 (from 0) # Receiving objects: 100% (3658/3658), 821.47 KiB | 276.00 KiB/s, done. # Resolving deltas: 100% (2409/2409), done. # From https://git.coopcloud.tech/coop-cloud/recipes-catalogue-json # * [new branch] main -> origin/main ~/.abra/catalogue$ git status # On branch master # # No commits yet # # nothing to commit (create/copy files and use "git add" to track) ~/.abra/catalogue$ git switch main # branch 'main' set up to track 'origin/main'. # Switched to a new branch 'main' ~/.abra/catalogue$ git status # On branch main # Your branch is up to date with 'origin/main'. # # nothing to commit, working tree clean ~/.abra/catalogue$ cd ../.. ~$ abra app new traefik # INFO single server detected, choosing ovh_plucky automatically # ? Specify app domain traefik.ovh_plucky # INFO traefik.ovh_plucky created (version: 3.10.0+v3.6.7) ``` ## Solution Dunno if updating the Troubleshooting is sufficient or warranted, b/c maybe this was peculiar to me or my git setup or how I installed `abra`. It also seems like there may be some internal refs to `master` that need renaming, too, possibly? Lemme know if I can give more context. Also, hi friends! 👋
Owner

Hi, welcome @jgaehring, thanks so much for reporting! This is a mysterious one indeed, we have no master branch on that repo 🤔 https://git.coopcloud.tech/toolshed/recipes-catalogue-json/branches

I'll see if I can get a reproducible test case going using Docker or a VM. If you have a second (and no pressure), I wonder if the problem happens consistently for you? You could test by e.g. doing:

ABRA_DIR=/tmp/abra
abra server add <your VPS FQDN>
abra app new traefik
Hi, welcome @jgaehring, thanks so much for reporting! This is a mysterious one indeed, we have no `master` branch on that repo 🤔 https://git.coopcloud.tech/toolshed/recipes-catalogue-json/branches I'll see if I can get a reproducible test case going using Docker or a VM. If you have a second (and no pressure), I wonder if the problem happens consistently for you? You could test by e.g. doing: ``` ABRA_DIR=/tmp/abra abra server add <your VPS FQDN> abra app new traefik ```
Author

Not sure if I set the ABRA_DIR properly, but trying that a few times I did not get the same error. I removed the existing Traefik app w/o setting any vars then recreating it w/ abra app new traefik but again with no errors; the app was created with expected behavior. Also tried it with Nextcloud and got no errors. I'm half-tempted to try reinstalling abra but for the moment would prefer not to, since it's been worked around well enough if not properly resolved.

I do wonder if this call to HasBranch might give a false positive for any reason, resulting in GetDefaultBranch returning the fallback "master" here:

pkg/git/branch.go Lines 62 to 74 in 4db6755f0d
// GetDefaultBranch retrieves the default branch of a repository.
func GetDefaultBranch(repo *git.Repository, repoPath string) (plumbing.ReferenceName, error) {
branch := "master"
if !HasBranch(repo, "master") {
if !HasBranch(repo, "main") {
return "", errors.New(i18n.G("failed to select default branch in %s", repoPath))
}
branch = "main"
}
return plumbing.ReferenceName(fmt.Sprintf("refs/heads/%s", branch)), nil
}

Just following a hunch, b/c while I'm not much familiar with Go, I have been monkeying with my local git configs lately. I still have my global init.defaultbranch set to main (not that that would effect it if it was master), but it still seemed a likely place to look. I dunno if this is relevant either, but after giving a shot at upgrading abra, like I mentioned above, I upgraded my git PPA and version from Ubuntu's stable upstream of git v.2.43.0 to the git-core PPA and git v.2.52.0. The results of abra app new traefik were the same both before and after all that, so probably inconsequential, but does seem to be within the same ballpark of concerns.

Also, so sorry I just realized I logged this in the docs repo rather than abra's! I think I opened this via the #272 issue page. 🤦

Not sure if I set the `ABRA_DIR` properly, but trying that a few times I did not get the same error. I removed the existing Traefik app w/o setting any vars then recreating it w/ `abra app new traefik` but again with no errors; the app was created with expected behavior. Also tried it with Nextcloud and got no errors. I'm half-tempted to try reinstalling `abra` but for the moment would prefer not to, since it's been worked around well enough if not properly resolved. I do wonder if this call to `HasBranch` might give a false positive for any reason, resulting in `GetDefaultBranch` returning the fallback `"master"` here: https://git.coopcloud.tech/toolshed/abra/src/commit/4db6755f0d8be992038e286a045c7da5a5a1d078/pkg/git/branch.go#L62-L74 Just following a hunch, b/c while I'm not much familiar with Go, I have been monkeying with my local git configs lately. I still have my global `init.defaultbranch` set to `main` (not that that would effect it if it *was* `master`), but it still seemed a likely place to look. I dunno if this is relevant either, but after giving a shot at upgrading `abra`, like I mentioned above, I upgraded my git PPA and version from Ubuntu's stable upstream of git v.2.43.0 to the git-core PPA and git v.2.52.0. The results of `abra app new traefik` were the same both before and after all that, so probably inconsequential, but does seem to be within the same ballpark of concerns. Also, so sorry I just realized I logged this in the docs repo rather than abra's! I think I opened this via the #272 issue page. 🤦
Owner
Related: https://git.coopcloud.tech/toolshed/organising/issues/394
Sign in to join this conversation.
No Label
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: toolshed/docs.coopcloud.tech#295
No description provided.