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

tea.unknownCSISequenceMsg: unknown message type panics #1016

Closed
twpayne opened this issue May 12, 2024 · 3 comments
Closed

tea.unknownCSISequenceMsg: unknown message type panics #1016

twpayne opened this issue May 12, 2024 · 3 comments
Labels

Comments

@twpayne
Copy link
Contributor

twpayne commented May 12, 2024

Describe the bug

bubbletea panics with the message tea.unknownCSISequenceMsg: unknown message type occasionally. I'm unable to reproduce this, but "Effective Go" states that libraries should not panic.

Setup

This was reported by users in:

To Reproduce

I am unable to reproduce it.

Source Code

See above.

Expected behavior

bubbletea should not panic, and it it does, it should include sufficient information to know what went wrong (e.g. the CIS sequence that caused the panic).

Screenshots

n/a

Additional context

Happy to help debug this!

@meowgorithm
Copy link
Member

Thanks for reporting this, Tom. Agreed: Bubble Tea should not be panicking here. We'll look into it, and while it may be a bug in Bubble Tea, I do wonder if the panic is happening higher up in chezmoi. By default, Bubble Tea catches panics in Programs so that it can disengage from the terminal and return it to a useable state.

Also note that there’s a newer version of Bubble Tea out (v0.26.2; it looks like chezmoi is on v0.25.0 per the stack trace).

@meowgorithm
Copy link
Member

Hey @twpayne; just following up on this. I do believe what we're seeing here is a panic in Chezmoi, with Bubble Tea simply recovering from the panic and restoring the terminal state. That's this item in the stack trace in Chezmoi #3758:

github.com/charmbracelet/bubbletea.(*Program).Run.func1()
	/home/runner/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.25.0/tea.go:478 +0x91
panic({0x12b4ec0?, 0xc00051c060?})

(Bubble Tea source)

Given that I'm going to close this issue, however in chance I'm wrong and you're able to reproduce the issue please do reopen this and we'll examine it further.

@twpayne
Copy link
Contributor Author

twpayne commented May 30, 2024

Ah, I'm sorry, you're totally right. Apologies for the noise.

I mistook the tea.unknownCSISequenceMsg part as coming from bubbletea, but now I see that this is actually a message type that send to a model's Update() method, and chezmoi's HTTP download spinner panics when it receives messages that it doesn't expect:

https://github.com/twpayne/chezmoi/blob/6845ab9adb4a301a9ce8387d4c96ab360e14062d/internal/cmd/readhttpresponse.go#L68

However, I see from charmbracelet/bubbles that unexpected messages should be ignored:

https://github.com/charmbracelet/bubbles/blob/bd562f9d85a3d38a858fb46a8cac9a8eee6b8481/spinner/spinner.go#L165-L166

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants