From a984a5a3865dda05357d2d80381b2b442f76aa2c Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Tue, 10 Nov 2026 11:25:38 +0000 Subject: [PATCH] fix(tools): Say when link_issue's Sentry App is not installed When the organization had no installation of the App that the URL points to, link_issue returned "Expected one installed Sentry App 'linear'." The agent could not tell that the App was missing or what would fix it. Report the missing installation, name the organization, and say that it must be installed under Settings > Integrations. The message for more than one matching installation is unchanged. --- .../mcp-core/src/tools/support/issue-linking/app.test.ts | 7 +++++++ packages/mcp-core/src/tools/support/issue-linking/app.ts | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/mcp-core/src/tools/support/issue-linking/app.test.ts b/packages/mcp-core/src/tools/support/issue-linking/app.test.ts index 6276e6d62..98760200c 100644 --- a/packages/mcp-core/src/tools/support/issue-linking/app.test.ts +++ b/packages/mcp-core/src/tools/support/issue-linking/app.test.ts @@ -287,6 +287,13 @@ describe("linkAppIssue", () => { expect(searches).toBe(1); }); + it("says the App must be installed when the organization has no installation", async () => { + mockDiscovery({ slug: "other" }); + await expect(linkAppIssue(api, params)).rejects.toThrow( + "The 'linear' Sentry App is not installed in organization 'example'", + ); + }); + it("requires a valid installed callback even for an existing association", async () => { mockDiscovery({ links: [association], diff --git a/packages/mcp-core/src/tools/support/issue-linking/app.ts b/packages/mcp-core/src/tools/support/issue-linking/app.ts index ce193039c..e17c566f6 100644 --- a/packages/mcp-core/src/tools/support/issue-linking/app.ts +++ b/packages/mcp-core/src/tools/support/issue-linking/app.ts @@ -317,7 +317,11 @@ export async function linkAppIssue( (installation) => installation.app.slug === appSlug && installation.status === "installed", ); - if (installed.length !== 1) + if (installed.length === 0) + throw new UserInputError( + `The '${appSlug}' Sentry App is not installed in organization '${params.organizationSlug}', so Sentry cannot link this issue to it. Someone who can manage integrations must install it under Settings > Integrations in Sentry, then retry.`, + ); + if (installed.length > 1) throw new UserInputError(`Expected one installed Sentry App '${appSlug}'.`); const installation = installed[0]!; const matchingComponents = components.filter(