seachicken / gh-poi

✨ Safely clean up your local branches
https://dev.to/seachicken/safely-clean-up-your-local-branches-9i3
MIT License
682 stars 19 forks source link

Error unmarshalling response: invalid character '\x1b' #104

Closed patrickclarkfish closed 1 year ago

patrickclarkfish commented 1 year ago

Description

Recently gh poi started returning this error error unmarshaling response: invalid character '\x1b' looking for beginning of value when it reaches the Fetching pull requests step. This happens regardless of repo, org, or PR status. Running with the debug flag doesn't seem to provide any additional helpful info.

Environment

seachicken commented 1 year ago

Thank you for reporting! I seem to be having a problem similar to this issue. https://github.com/seachicken/gh-poi/issues/79#issuecomment-1306377988

This error is failed GitHub API response parsing. I would like to know the gh command that caused the error, so can you run gh poi --debug and tell me the output of run gh [xxxx]?

patrickclarkfish commented 1 year ago

run gh [repo view github.com/myorg/coolrepo --json owner,name,parent,defaultBranchRef --jq .] seems to be the culprit. The output looks like this (with some details obscured): { "defaultBranchRef": { "name": "dev" }, "name": "coolrepo", "owner": { "id": "abcd123...xyz==", "login": "myorg" }, "parent": null }

seachicken commented 1 year ago

Thanks for the information! This problem is affected by the change in output with escape sequences by gh since v2.29.0. https://github.com/cli/cli/pull/7236

$ gh repo view --json name --jq .                                                                                                                                     

output gh v2.27.0:

スクリーンショット 2023-06-08 13 35 11

output since gh v2.29.0:

スクリーンショット 2023-06-08 13 35 49

I will figure out how to fix it.

seachicken commented 1 year ago

Fixed gh poi v0.9.2 has been released. If you still have problems, please let me know the contents of --debug again, as I have changed the log format.

patrickclarkfish commented 1 year ago

I did start with problems again, but a little digging showed that CLICOLOR_FORCE was enabled which was overriding your changes. I tracked down where that was set and cleaned it up and it works now!

seachicken commented 1 year ago

Wow, thank you for your sharing. I'm reproducing with CLICOLOR_FORCE=1 gh poi. Ideally, we would like to avoid the influence of environmental variables, so I will try to figure out how to modify it.