Skip to content

panic: runtime error when trying to run gh auth refresh #6139

@martin-raisely

Description

@martin-raisely

Describe the bug

I get an "panic: runtime error: invalid memory address or nil pointer dereference" error when trying to gh auth refresh after logging in using HTTPs protocol.

I'm running on a M1 MacBook, and installed gh cli using Homebrew.

gh version 2.14.6 (2022-08-24)
https://github.com/cli/cli/releases/tag/v2.14.6

Steps to reproduce the behavior

  1. Type this '...'
    gh auth refresh

  2. See error

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x20 pc=0x100bcf6c0]

goroutine 1 [running]:
github.com/cli/cli/v2/pkg/cmd/auth/shared.(*GitCredentialFlow).Prompt(0x140007bfab8, {0x100d508fe?, 0x101c1e1e6?})
        github.com/cli/cli/v2/pkg/cmd/auth/shared/git_credential.go:35 +0x130
github.com/cli/cli/v2/pkg/cmd/auth/refresh.refreshRun(0x1400015ef00)
        github.com/cli/cli/v2/pkg/cmd/auth/refresh/refresh.go:144 +0x46c
github.com/cli/cli/v2/pkg/cmd/auth/refresh.NewCmdRefresh.func2(0x1400046db80?, {0x1023f1e08?, 0x0?, 0x0?})
        github.com/cli/cli/v2/pkg/cmd/auth/refresh/refresh.go:71 +0xb8
github.com/spf13/cobra.(*Command).execute(0x1400046db80, {0x1023f1e08, 0x0, 0x0})
        github.com/spf13/cobra@v1.4.0/command.go:856 +0x4c4
github.com/spf13/cobra.(*Command).ExecuteC(0x14000413680)
        github.com/spf13/cobra@v1.4.0/command.go:974 +0x354
main.mainRun()
        github.com/cli/cli/v2/cmd/gh/main.go:214 +0xaa0
main.main()
        github.com/cli/cli/v2/cmd/gh/main.go:48 +0x1c

Expected vs actual behavior

I'd expect to be taken to a window to re-authenticate.

I am trying to run gh auth refresh -s codespace but get the same error

Logs

See above

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpriority-2Affects more than a few users but doesn't prevent core functions

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions