Errors
How TagManifest returns errors. The REST envelope, status codes, example messages, and how errors look over MCP.
On this page 5
Every error response from the REST API carries a JSON body with an error field. Most errors are a flat envelope with a single string. A few add more fields. HTTP status codes follow standard semantics. The MCP endpoint reports errors differently; see MCP errors.
Error envelope
All non-2xx REST responses return JSON with at minimum:
{
"error": "<message>"
}
For most errors the error value is a sentence that says what went wrong, and the HTTP status is the machine-readable signal. Four errors use a short code in error and put the sentence in a message field: rate_limit_exceeded (429), insufficient_scope (403), payload_too_large (413) and rate_limiter_unavailable (503).
Status codes
| Status | Meaning | Example error message |
|---|---|---|
| 400 | A required field is missing. | "Provide either url or gtm_id" |
| 400 | "Missing required field: rule_id" | |
| 400 | "Provide one of: data, gtm_id, url" | |
| 400 | "Missing required field: data (parsed container)" | |
| 400 | "Missing required query param: rule_id" | |
| 400 | "Missing required query param: id" | |
| 400 | A value is malformed. | "url must be a full http(s) URL" |
| 400 | "Invalid gtm_id format: GTM-???" | |
| 400 | "Invalid key id" | |
| 400 | "label must be a string" | |
| 400 | "label must be 60 characters or fewer" | |
| 400 | Unknown filter value, misspelt field or bad count. The message lists what is accepted. | "Unknown category \"privacy\". Category must be one of: consent, ga4, ..." |
| 400 | "Unknown field: \"categories\" (did you mean \"category\"?). Accepted: ..." | |
| 400 | "top_n must be a number of 0 or more (got -5)." | |
| 400 | "include_evidence must be true or false (got \"yes\")." | |
| 400 | data is not a GTM container. | See Bad data below. |
| 401 | Missing or invalid bearer token. | "Missing or malformed Authorization header" |
| 401 | "Invalid or revoked API key" | |
| 401 | "Invalid or expired token" | |
| 403 | Token type not permitted for this endpoint. | "API keys cannot manage API keys — use a session JWT" |
| 403 | "MCP access tokens cannot manage API keys — use a session JWT" | |
| 403 | Key creation is limited to approved accounts and this account is not one of them. | "Key creation is limited to approved accounts." |
| 403 | The token was not granted the scope this endpoint needs. | "insufficient_scope" (with a message field naming the scope) |
| 404 | Resource not found, or no GTM container detected. | "No GTM container ID found in page HTML" |
| 404 | "Key not found" | |
| 404 | "Unknown rule_id: <id>" (from POST /v1/evaluate-rule) | |
| 404 | "Rule not found: <id>" (from GET /v1/rules-detail) | |
| 405 | Wrong HTTP method for this endpoint. | "Method not allowed. Use POST." |
| 409 | The account already holds five active API keys. | "This account already has 5 active keys. Revoke one to create another." |
| 413 | Request body over 10 MB. | "payload_too_large" (with a message field) |
| 429 | Daily rate limit exceeded. | See Rate-limit errors below. |
| 500 | Internal error. | "Internal error" |
| 500 | "Auth check failed" | |
| 500 | "Rule evaluation failed: <message>" | |
| 500 | "Registry read failed: <status> <detail>" | |
| 500 | "Key generation failed", "Failed to list keys", "Revoke failed" | |
| 502 | Upstream fetch failed: the page or Google's gtm.js could not be fetched. | "Failed to fetch page: https://example.com (HTTP 403)" |
| 502 | "Container fetch failed: Failed to fetch gtm.js: HTTP 404. Google has no published container with that ID: check the ID, and that the container has been published." | |
| 503 | The rate limiter could not be reached. The request was not run. | "rate_limiter_unavailable" (with a message field and a Retry-After: 30 header) |
400 — bad request
Returned when a required field is missing, a value is malformed, or the request has a field or filter value the endpoint does not take. The error string names the specific problem.
Requests are checked strictly:
- Unknown fields and query parameters are refused on four endpoints. These are the bodies of
POST /v1/scan-url,POST /v1/scanandPOST /v1/evaluate-rule, and the query string ofGET /v1/rules. A misspelt field such ascategoriesgets a 400 that names the field. When an accepted name is close, the message suggests it.GET /v1/rules-detailignores extra query parameters, andPOST /v1/api-keysignores extra body fields. - Filter values must be real.
category,tierandstatusmust be one of the accepted values. The message lists them. An empty string is refused too: leave the field out. - Counts must be 0 or more.
top_nandlimittake a number or numeric text such as"10". A fraction is rounded down. A negative number or other text is refused. include_evidencemust betrueorfalse. The text forms"true"and"false"are accepted.nullcounts as left out. Anullforcategory,tier,top_norinclude_evidencein a request body is treated as if the field was not sent. It is not an error.
A REST request that fails one of these checks has already been counted against the daily limit.
Bad data
POST /v1/scan and POST /v1/evaluate-rule take a container in data. It must be a GTM JSON export, sent as downloaded, or a container TagManifest has already parsed. Anything else is refused, so that input which was never audited cannot come back with zero findings and a perfect score.
error message | Cause |
|---|---|
"data must be a GTM container: a GTM JSON export or a parsed container object" | data is not an object, for example a string or an array. |
"data.containerVersion is not a GTM export: expected a container record with a publicId" | data has a containerVersion key but no containerVersion.container record with an ID. |
"data.containerVersion.tag must be an array of objects" | tag, trigger, variable or folder inside containerVersion is present but is not an array of objects. The message names the key. |
"Could not parse GTM export: <detail>" | The export has the right outline but could not be parsed. |
"data is not a GTM container: expected a GTM JSON export (with containerVersion) or a parsed container (with tags, triggers and variables arrays of objects)" | data is an object but is neither form. |
401 — unauthorized
Returned when the Authorization header is absent, the bearer token is malformed, or the token is unknown, expired or revoked. The message tells API key failures ("Invalid or revoked API key") from other token failures ("Invalid or expired token").
403 — forbidden
A 403 is returned when an API key or a valid MCP access token is sent to the /v1/api-keys endpoints. A token that starts with tm_ is refused on the prefix alone. An MCP access token is checked first, so an expired one gets a 401. Key management takes only the account page's session token. This stops a leaked key, or a token granted to an MCP client, from creating more keys.
POST /v1/api-keys can also return a 403 with "Key creation is limited to approved accounts." Key creation can be limited to a list of approved accounts. This is the answer for a signed-in account outside that list.
A 403 with "error": "insufficient_scope" is returned when an MCP access token is sent to a REST endpoint it was not granted. A token granted only mcp:read can call GET /v1/rules and GET /v1/rules-detail. The endpoints that run a scan or a rule need mcp:tools. The response carries a WWW-Authenticate header that names the scope. The call is not counted against the rate limit. API keys carry both scopes.
{
"error": "insufficient_scope",
"message": "This token was not granted 'mcp:tools', which this endpoint requires."
}
404 — not found
Used for three situations: a key ID that does not exist or belongs to another user, a rule_id that matches no rule, and a page whose HTML contains no GTM- container ID.
409 — conflict
POST /v1/api-keys returns 409 when the account already has five active keys. Revoke one, then create the new key. Revoked keys do not count towards the five.
413 — payload too large
Request bodies are limited to 10 MB on the scan and rule endpoints and on /mcp. A larger body is refused before it is processed:
{
"error": "payload_too_large",
"message": "Request body too large. The limit is 10 MB."
}
POST /v1/api-keys has a much smaller limit of 16 KB and answers { "error": "Request body too large" }.
502 — bad gateway
Returned when the API accepted the request but could not fetch something it needed: the page you named, or the container file from www.googletagmanager.com. The message includes the reason, usually the HTTP status the other server returned.
"Failed to fetch page: …"means the page could not be fetched. Check the address is public and reachable."Container fetch failed: Failed to fetch gtm.js: HTTP 404…"means Google has no published container with that ID. OnPOST /v1/scan-urlthe message adds a hint:Google has no published container with that ID: check the ID, and that the container has been published.Retrying will give the same result.- Other upstream failures may clear on a retry.
503 — limiter unavailable
If the rate limiter cannot be reached, POST /v1/scan-url, POST /v1/scan and POST /v1/evaluate-rule refuse the request instead of running it uncounted. The response has a Retry-After: 30 header.
{
"error": "rate_limiter_unavailable",
"message": "Rate limiter temporarily unavailable; request rejected to protect compute limits. Please retry shortly."
}
Rate-limit errors
When the daily limit for a tool is exhausted, the endpoint returns HTTP 429 with an extended error body:
| Field | Type | Description |
|---|---|---|
error | string | Always "rate_limit_exceeded". |
message | string | Human-readable message including tool name, count, and limit. |
tool | string | The tool bucket that was exhausted. |
limit | number | Daily cap for this tool. |
count | number | Current count at the time of the failure. |
reset_at | string | ISO 8601 UTC timestamp when the bucket resets (next 00:00 UTC). |
The X-RateLimit-* headers are present on a 429. See Rate limits for which responses carry them and for the per-tool limits.
Auth errors
Auth errors return a plain { "error": "..." } envelope with HTTP 401 or 403. The one exception is insufficient_scope, which adds a message field. See Authentication for the token kinds and the full list of messages.
MCP errors
The MCP endpoint speaks JSON-RPC 2.0. A tool call that goes wrong is reported in one of three ways. All three come back over HTTP 200.
| What went wrong | How it is reported | Counted against the rate limit |
|---|---|---|
| Bad arguments caught by the checks that run first | JSON-RPC error, code -32602 | No |
| Rate limit reached, or limiter unavailable | JSON-RPC error, code -32603 | — |
| The tool ran and failed, including bad input found only while it ran | A normal result with isError: true | Yes |
Bad arguments: -32602
Some checks run before the tool starts and before the rate limit is touched. A call refused by one of them does not use up one of the day's calls. These checks are:
- an unknown tool name
- a missing required argument, such as
rule_idforget_rule - a top-level argument the tool does not take. The message suggests an accepted name when one is close.
account_statusis the exception: it ignores extra arguments - a
category,tierorstatusthat is not an accepted value - a
top_norlimitthat is negative or not a number - a top-level string or object argument of the wrong basic type, such as a number for
urlor a string fordata - a token without the scope the tool needs
These checks look at top-level arguments only. The mistakes below are found once the tool is running. The call has been counted by then, and the answer is a tool result with isError: true:
- a
dataobject that is not a GTM container - no container source: neither
urlnorgtm_idforscan_url, or none ofurl,gtm_idanddataforevaluate_ruleandget_health_score - a bad value inside
aorbofcompare_containers
{
"jsonrpc": "2.0",
"id": 3,
"error": {
"code": -32602,
"message": "Unknown category \"privacy\". Category must be one of: consent, ga4, ads, ecommerce, security, pii, performance, quality, organization, dead-code. To check one rule by its rule_id, use evaluate_rule."
}
}
Rate limit: -32603
{
"jsonrpc": "2.0",
"id": 7,
"error": {
"code": -32603,
"message": "Rate limit exceeded for scan_url: 101/100. Resets at 2026-05-05T00:00:00.000Z."
}
}
There are no X-RateLimit-* headers on MCP responses. The reset time is in the message.
Tool failures: isError: true
A tool that starts and then fails returns a normal JSON-RPC result. The result has isError: true and the message as text content, so the model can read it and recover. Examples are a rule ID that does not exist, a page with no GTM snippet, and a container Google does not serve.
{
"jsonrpc": "2.0",
"id": 4,
"result": {
"content": [
{ "type": "text", "text": "Rule not found: not-a-rule" }
],
"isError": true
}
}
Transport errors
A few failures happen before a tool is reached and do use HTTP status codes. Most have a JSON-RPC error body. Two do not, as the table shows.
| HTTP | JSON-RPC code | Cause |
|---|---|---|
| 400 | -32700 | The body is not valid JSON. |
| 400 | -32600 | No method, or a jsonrpc version other than "2.0". |
| 400 | -32602 | tools/call without a tool name. |
| 401 | -32600 | Missing or invalid token. The response has a WWW-Authenticate header so the client can sign in again. |
| 401 | none | A notification (a message with no id) with a missing or invalid token. The body is empty. The WWW-Authenticate header is still set. |
| 404 | -32601 | Unknown method. |
| 405 | none | An HTTP method other than POST, GET or OPTIONS. The body is plain JSON: { "error": "Method not allowed" }. |
| 413 | -32600 | Body over 10 MB. |
| 500 | -32603 | The token could not be checked, or the server hit an unexpected error. |
A notification that gets past the token check is answered with HTTP 202 and an empty body. It is acknowledged and not run, even when its method is tools/call. Put an id on every message you want an answer to.
Examples
{
"error": "No GTM container ID found in page HTML"
}
{
"error": "rate_limit_exceeded",
"message": "Daily limit reached for scan_url (101/100)",
"tool": "scan_url",
"limit": 100,
"count": 101,
"reset_at": "2026-05-05T00:00:00.000Z"
}
{
"error": "Invalid or revoked API key"
}
{
"jsonrpc": "2.0",
"id": 3,
"error": {
"code": -32602,
"message": "Unknown argument for scan_url: \"categories\" (did you mean \"category\"?). Accepted: url, gtm_id, category, tier, top_n, data."
}
}
{
"jsonrpc": "2.0",
"id": 4,
"result": {
"content": [
{ "type": "text", "text": "Rule not found: not-a-rule" }
],
"isError": true
}
}