Skip to content

fix(content api): report GraphQL errors that have no locations - #528

Merged
mattrossman merged 2 commits into
supabase:mainfrom
irisfield:fix/content-api-error-locations
Nov 6, 2026
Merged

mattrossman merged 2 commits into
supabase:mainfrom
irisfield:fix/content-api-error-locations

Conversation

@irisfield

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

Fixes #527

graphqlErrorSchema requires locations, so a Content API error without it fails the response parse and search_docs reports the parse failure instead of the error message.

What is the new behavior?

locations is optional. The error message gets (line X, column Y) when the error has a location, and is shown alone when it does not. An empty locations array, which used to print (line unknown, column unknown), follows the same rule.

graphql_query before after
two named operations Failed to parse Supabase Content API response: [ … "path": ["errors", 0, "locations"] … ] Supabase Content API GraphQL error: GET requests must specify an operation name or send only a single operation
{ nope } Supabase Content API GraphQL error: Cannot query field "nope" on type "RootQueryType". (line 1, column 3) same

No change to tool names, descriptions, or input and output schemas.

How to Review

  1. Error schema and message

    • packages/mcp-server-supabase/src/content-api/graphql.ts
    • graphqlErrorSchema.locations is optional, and the data.errors message adds the position only when there is one.
  2. Tests

    • packages/mcp-server-supabase/src/content-api/graphql.test.ts
    • Two Content API error responses through a mocked fetch: one with locations, whose message is unchanged, and one without.

Review questions

  • Should Content API GraphQL errors such as this one be a ToolCallerError, since the query is the caller's mistake? This PR keeps them as plain Error.

Verification

  • With only the test file applied on main, the no-locations case fails with the parse error and the other cases pass.
  • CI=1 npx vitest run --project unit: 34 files, 868 passed.
  • npx tsc --noEmit and pnpm format:check: clean.
  • Running the built server and calling search_docs against the live Content API gives the "after" column above.

Additional context

search_docs sends GET requests, so the Content API's wording is the GET one above rather than the POST message quoted in #527.

The Content API leaves out locations on request-level errors, such as a
query with two operations. The response schema required locations, so
search_docs reported a parse failure instead of the error message. Make
locations optional and add the position only when there is one.

Fixes supabase#527

@mattrossman mattrossman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mattrossman
mattrossman merged commit 6b2fca9 into supabase:main Nov 6, 2026
4 of 5 checks passed
@supabase-releaser supabase-releaser Bot mentioned this pull request Nov 6, 2026
@irisfield
irisfield deleted the fix/content-api-error-locations branch November 6, 2026 17:50
barryroodt pushed a commit that referenced this pull request Nov 13, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>mcp-utils: 0.10.0</summary>

##
[0.10.0](mcp-utils-v0.9.0...mcp-utils-v0.10.0)
(2026-11-13)


### Features

* tag cost-confirmation errors and report caller-input errors as
ToolCallerError ([#543](#543))
([ac366c4](ac366c4))
</details>

<details><summary>mcp-server-supabase: 0.17.0</summary>

##
[0.17.0](mcp-server-supabase-v0.16.1...mcp-server-supabase-v0.17.0)
(2026-11-13)


### ⚠ BREAKING CHANGES

* **elicitation:** split confirmation and secret collection TTLs
([#538](#538))

### Features

* agent feedback capabilities including docs
([#488](#488))
([698ccd5](698ccd5))
* **elicitation:** split confirmation and secret collection TTLs
([#538](#538))
([8a08e48](8a08e48))
* tag cost-confirmation errors and report caller-input errors as
ToolCallerError ([#543](#543))
([ac366c4](ac366c4))


### Bug Fixes

* **content api:** report GraphQL errors that have no locations
([#528](#528))
([6b2fca9](6b2fca9))
* **mcp:** confirm UPDATEs without WHERE that have a leading comment,
ONLY or an alias ([#524](#524))
([7df9fb8](7df9fb8))
* **mcp:** don't read semicolons or EXECUTE inside data literals as
destructive SQL ([#533](#533))
([0dcdd2d](0dcdd2d))
* tell agents the log window, project readiness, docs query and SQL size
rules up front ([#542](#542))
([23f0df0](23f0df0))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

search_docs reports a response parse failure instead of the Content API error when the error has no locations

2 participants