Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trying to update workspace, getting "Unhandled exception: Branch statuses must not be empty" #6214

Open
brianloveswords opened this issue Feb 6, 2025 · 5 comments
Labels
bug Something isn't working

Comments

@brianloveswords
Copy link

screenshot of the error toast:
Image

anything I can do to manually get past this error using git cli? i don't want to mess up my GitButler workspace.

@brianloveswords
Copy link
Author

also, let me know if you need any more information for debugging and I'll provide what I can

@Byron Byron added the bug Something isn't working label Feb 7, 2025
@Byron
Copy link
Collaborator

Byron commented Feb 7, 2025

Thanks a lot for reporting!

The error messages originates here:

fn create(tree_status: TreeStatus, branch_statuses: Vec<NameAndStatus>) -> Result<Self> {
if branch_statuses.is_empty() {
bail!("Branch statuses must not be empty")
}
Ok(Self {
tree_status,
branch_statuses,
})
}

Following the code just a little bit seems to indicate that it could run into this if there was not a single branch. Having a workspace would imply this is the case though, but maybe there is an empty stack, i.e. a stack without any branches?

This of course shouldn't be possible, but seems to be a plausible reason for running into this.

In order to workaround this error, I think one would have to try and manually delete the empty stack in .git/gitbutler/virtual_branches.toml. If it doesn't contain sensitive information, you could post it here and we take it from there.

anything I can do to manually get past this error using git cli?

Unfortunately that's not yet possible.

@Byron Byron added the feedback requested Feedback was requested to help resolve the issue label Feb 7, 2025
@BramLeisink
Copy link

Hi everyone,

I’m running into the same issue and wanted to add my experience in case it helps debug the problem.

I committed changes inside a lane that (as far as I understand) did not have any branch linked to it. I’m still new to GitButler, but this might explain why the system is running into a state where branch_statuses is empty.

Here’s my full .git/gitbutler/virtual_branches.toml file (with remoteUrl and sha redacted for privacy), the lane that is causing problems is "Lane":

[default_target]
branchName = "main"
remoteName = "origin"
remoteUrl = "REDACTED"
sha = "REDACTED"
pushRemoteName = "origin"

[branch_targets]

[branches.ded5c586-068d-4a7c-b2e2-dd0c07d5643a]
id = "ded5c586-068d-4a7c-b2e2-dd0c07d5643a"
name = "Lane 2"
notes = ""
created_timestamp_ms = "1739549649334"
updated_timestamp_ms = "1739549691705"
tree = "f0a7ec27c9d9d835c5db62377cefb974704ca95b"
head = "98bda633f83def60c3d357c7ba9b80400ddef4e5"
ownership = ""
order = 2
allow_rebasing = true
in_workspace = true
post_commits = false

[[branches.ded5c586-068d-4a7c-b2e2-dd0c07d5643a.heads]]
name = "bl-branch-3"
archived = false

[branches.ded5c586-068d-4a7c-b2e2-dd0c07d5643a.heads.head]
ChangeId = "7bb6ca97-04af-48ce-af42-63f2de57bc6e"

[branches.669e944f-f4d9-4086-bcd6-1edc8129350a]
id = "669e944f-f4d9-4086-bcd6-1edc8129350a"
name = "Lane"
notes = ""
created_timestamp_ms = "1739295410585"
updated_timestamp_ms = "1739556529867"
tree = "0ea6968a2bc3993738f68df3dc825b5200fd0683"
head = "534743807fac35ec840bbb518146ab6e9dd7479c"
ownership = ""
order = 1
allow_rebasing = true
in_workspace = true
post_commits = false

[[branches.669e944f-f4d9-4086-bcd6-1edc8129350a.heads]]
name = "cms"
archived = false

[branches.669e944f-f4d9-4086-bcd6-1edc8129350a.heads.head]
ChangeId = "726553b7-8219-4169-9130-fd6195b7ad81"

[branches.ef692c3d-b96f-4e44-82b6-2ef3040558b9]
id = "ef692c3d-b96f-4e44-82b6-2ef3040558b9"
name = "Lane 1"
notes = ""
created_timestamp_ms = "1739296018215"
updated_timestamp_ms = "1739556391810"
tree = "b9b6fa2646c05b96c31599c86a6762cb70c5ca46"
head = "619bb78faf96ff2d89f5adc676cc6e4f0fb0ab56"
ownership = ""
order = 0
selected_for_changes = 1739549855069
allow_rebasing = true
in_workspace = true
post_commits = false

[[branches.ef692c3d-b96f-4e44-82b6-2ef3040558b9.heads]]
name = "bl-branch-2"
archived = true

[branches.ef692c3d-b96f-4e44-82b6-2ef3040558b9.heads.head]
ChangeId = "eccd264b-ace0-4c41-bb0c-447e0e995c0f"

Additionally, I took a screenshot which might provide more context. Let me know if sharing that would be helpful!

Image

I’d appreciate any guidance on how to resolve this, whether by manually editing .git/gitbutler/virtual_branches.toml or some other approach. Thanks!

(Translated with ChatGPT)

@Byron Byron removed the feedback requested Feedback was requested to help resolve the issue label Feb 15, 2025
@Byron
Copy link
Collaborator

Byron commented Feb 15, 2025

Thanks for sharing!

Even though I still don't know if there is a workaround or what's truly causing this, I'd hope that it resolves itself once the new major release is available. A lot of the old codepaths won't be exercised anymore then.

@brianloveswords
Copy link
Author

sorry for the delay in getting this to you, here's what my virtual_branches.toml looks like. let me know if there's anything I can manually fiddle with to get unblocked!

[default_target]
branchName = "main"
remoteName = "origin"
remoteUrl = "REDACTED"
sha = "c49fc54067a0dfdae3db4fc49cec3d7a69f85548"
pushRemoteName = "origin"

[branch_targets]

[branches.a14ded4f-1ba4-42ce-b481-eb90e3acaf87]
id = "a14ded4f-1ba4-42ce-b481-eb90e3acaf87"
name = "Lane"
notes = ""
created_timestamp_ms = "1737585713440"
updated_timestamp_ms = "1739220072161"
tree = "8868a58a54c11c4fe70c32787e4e64796c48cd31"
head = "d2cbc78f67bfc8d46dfc2e5d886b33923aabba90"
ownership = """
brian.brennan/2025-01 sip tiers v2/sql/1-setup.sql:74-90-9599a69ad51b3c1ccbc1d440c020d019,49-71-ca9734a34e44ac18e36233904c6735b3,29-48-7364be8420c5c9b769d4d023f89e8418
"""
order = 0
selected_for_changes = 1738518866532
allow_rebasing = true
in_workspace = true
post_commits = false

[[branches.a14ded4f-1ba4-42ce-b481-eb90e3acaf87.heads]]
name = "bjb/sip-ratios"
archived = false

[branches.a14ded4f-1ba4-42ce-b481-eb90e3acaf87.heads.head]
ChangeId = "cf194ac4-720f-4516-8cab-b65645975956"

[branches.483caff1-5409-4f71-b223-0f19d0af63e4]
id = "483caff1-5409-4f71-b223-0f19d0af63e4"
name = "Lane 1"
notes = ""
created_timestamp_ms = "1737669560680"
updated_timestamp_ms = "1738202133969"
tree = "7d477802dfad180d4c5020a394b8c464db118841"
head = "c49fc54067a0dfdae3db4fc49cec3d7a69f85548"
ownership = """
brian.brennan/2025-01 cross ctc activity/analysis.sql:1-114-ca2f5661b28ff351b18aa03b60a5baa6
brian.brennan/2025-01 cross ctc activity/analysis.sh:1-4-5f03d29b74b4eaa16c1066cd8c4392a8
brian.brennan/2025-01 cross ctc activity/README.md:1-13-f126e61d896b4a27ddfe396081696599
brian.brennan/2025-01 cross ctc activity/.gitignore:1-11-b980666f823ad365a08627aa372f222a
"""
order = 1
allow_rebasing = true
in_workspace = true
post_commits = false

[[branches.483caff1-5409-4f71-b223-0f19d0af63e4.heads]]
name = "bjb/cross-ctc"
archived = true

[branches.483caff1-5409-4f71-b223-0f19d0af63e4.heads.head]
CommitId = "c49fc54067a0dfdae3db4fc49cec3d7a69f85548"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants