Skip to content

Github: can't upload assets to release due to nil pointer dereference #178

Closed

Description

@stryan

Getting the following errors when trying to upload an asset to a Github release:

forge --host github.com --repo stryan/repo release upload v0.8.0-rc1 ./dist/bin-v0.8.0-rc1-amd64.tar.gz                                                                                                                                                                    &1 4:07:19 PM
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x71dbda]

goroutine 1 [running]:
github.com/google/go-github/v82/github.(*RepositoriesService).UploadReleaseAsset(0x338867f98d78, {0xaf1ab8, 0xf0b380}, {0x7fffe4f9dfa4?, 0x7fffe4f9dfab?}, {0x7fffe4f9dfab, 0x7}, 0x18d6082a, 0x0, 0x338867df8a48)
        /home/runner/go/pkg/mod/github.com/google/go-github/v82@v82.0.0/github/repos_releases.go:476 +0x27a
github.com/git-pkgs/forge/github.(*gitHubReleaseService).UploadAsset(0x338867df8a50, {0xaf1ab8, 0xf0b380}, {0x7fffe4f9dfa4, 0x6}, {0x7fffe4f9dfab, 0x7}, {0x7fffe4f9dfc2?, 0x0?}, 0x338867df8a48)
        /home/runner/work/forge/forge/github/releases.go:234 +0x11c
github.com/git-pkgs/forge/internal/cli.init.15.releaseUploadCmd.func2(0x33886801e008, {0x338867ebcae0?, 0x4?, 0xaabc5a?})
        /home/runner/work/forge/forge/internal/cli/release.go:335 +0x20c
github.com/spf13/cobra.(*Command).execute(0x33886801e008, {0x338867ebca80, 0x6, 0x6})
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.10.2/command.go:1015 +0xb14
github.com/spf13/cobra.(*Command).ExecuteC(0xee2740)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.10.2/command.go:1148 +0x465
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.10.2/command.go:1071
github.com/git-pkgs/forge/internal/cli.Execute(...)
        /home/runner/work/forge/forge/internal/cli/root.go:51
main.main()
        /home/runner/work/forge/forge/cmd/forge/main.go:10 +0x65

I believe the issue is at https://github.com/git-pkgs/forge/blob/main/github/releases.go#L234 . UploadReleaseAsset runs if opts.MediaType != "", so it can't be called with nil as an opts. Probably an issue in go-github.

Activity

  1. CloudCorpRecords commented on Oct 18, 2026

    @CloudCorpRecords
    Contributor

    Hi, I'm CloudCorpRecords. I'd like to take this on: Github: can't upload assets to release due to nil pointer dereference.

    I'm commenting first per the repo's contribution guidelines, and I'll follow the contribution process. I'll open a PR against the issue once the work is ready.

    Claimed under the Greenlight Claim Protocol: this claim renews or expires
    automatically, and releases the moment a PR is linked or I say so.

  2. added a commit that references this issue on Oct 19, 2026
    803fd52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions