From ff8873da07e291dcbe7043e953a23ad3329ccf18 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Mar 2026 12:28:54 +0100 Subject: [PATCH] Fix extension install error message showing raw struct instead of owner/repo (#12836) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: williammartin <1611510+williammartin@users.noreply.github.com> --- pkg/cmd/extension/manager.go | 2 +- pkg/cmd/extension/manager_test.go | 33 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/pkg/cmd/extension/manager.go b/pkg/cmd/extension/manager.go index b7f1f1c0c..de758f5a3 100644 --- a/pkg/cmd/extension/manager.go +++ b/pkg/cmd/extension/manager.go @@ -268,7 +268,7 @@ func (m *Manager) Install(repo ghrepo.Interface, target string) error { return err } if !hs { - return fmt.Errorf("extension is not installable: no usable release artifact or script found in %s", repo) + return fmt.Errorf("extension is not installable: no usable release artifact or script found in %s", ghrepo.FullName(repo)) } return m.installGit(repo, target) diff --git a/pkg/cmd/extension/manager_test.go b/pkg/cmd/extension/manager_test.go index e933f0bdf..1e8f82483 100644 --- a/pkg/cmd/extension/manager_test.go +++ b/pkg/cmd/extension/manager_test.go @@ -867,6 +867,39 @@ func TestManager_Install_git(t *testing.T) { assert.NoDirExistsf(t, extensionUpdatePath, "update directory should be removed") } +func TestManager_Install_not_installable(t *testing.T) { + dataDir := t.TempDir() + updateDir := t.TempDir() + + reg := httpmock.Registry{} + defer reg.Verify(t) + client := http.Client{Transport: ®} + + ios, _, _, _ := iostreams.Test() + + m := newTestManager(dataDir, updateDir, &client, nil, ios) + + reg.Register( + httpmock.REST("GET", "repos/owner/gh-some-ext/releases/latest"), + httpmock.JSONResponse( + release{ + Assets: []releaseAsset{ + { + Name: "not-a-binary", + APIURL: "https://example.com/release/cool", + }, + }, + })) + reg.Register( + httpmock.REST("GET", "repos/owner/gh-some-ext/contents/gh-some-ext"), + httpmock.StatusStringResponse(404, "not found")) + + repo := ghrepo.New("owner", "gh-some-ext") + + err := m.Install(repo, "") + assert.EqualError(t, err, "extension is not installable: no usable release artifact or script found in owner/gh-some-ext") +} + func TestManager_Install_git_pinned(t *testing.T) { dataDir := t.TempDir() updateDir := t.TempDir()