Skip to main content
TagManifest /Docs Dashboard

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

StatusMeaningExample error message
400A 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"
400A 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"
400Unknown 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\")."
400data is not a GTM container.See Bad data below.
401Missing or invalid bearer token."Missing or malformed Authorization header"
401"Invalid or revoked API key"
401"Invalid or expired token"
403Token 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"
403Key creation is limited to approved accounts and this account is not one of them."Key creation is limited to approved accounts."
403The token was not granted the scope this endpoint needs."insufficient_scope" (with a message field naming the scope)
404Resource 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)
405Wrong HTTP method for this endpoint."Method not allowed. Use POST."
409The account already holds five active API keys."This account already has 5 active keys. Revoke one to create another."
413Request body over 10 MB."payload_too_large" (with a message field)
429Daily rate limit exceeded.See Rate-limit errors below.
500Internal 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"
502Upstream 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."
503The 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/scan and POST /v1/evaluate-rule, and the query string of GET /v1/rules. A misspelt field such as categories gets a 400 that names the field. When an accepted name is close, the message suggests it. GET /v1/rules-detail ignores extra query parameters, and POST /v1/api-keys ignores extra body fields.
  • Filter values must be real. category, tier and status must 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_n and limit take a number or numeric text such as "10". A fraction is rounded down. A negative number or other text is refused.
  • include_evidence must be true or false. The text forms "true" and "false" are accepted.
  • null counts as left out. A null for category, tier, top_n or include_evidence in 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 messageCause
"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. On POST /v1/scan-url the 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:

FieldTypeDescription
errorstringAlways "rate_limit_exceeded".
messagestringHuman-readable message including tool name, count, and limit.
toolstringThe tool bucket that was exhausted.
limitnumberDaily cap for this tool.
countnumberCurrent count at the time of the failure.
reset_atstringISO 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 wrongHow it is reportedCounted against the rate limit
Bad arguments caught by the checks that run firstJSON-RPC error, code -32602No
Rate limit reached, or limiter unavailableJSON-RPC error, code -32603—
The tool ran and failed, including bad input found only while it ranA normal result with isError: trueYes

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_id for get_rule
  • a top-level argument the tool does not take. The message suggests an accepted name when one is close. account_status is the exception: it ignores extra arguments
  • a category, tier or status that is not an accepted value
  • a top_n or limit that is negative or not a number
  • a top-level string or object argument of the wrong basic type, such as a number for url or a string for data
  • 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 data object that is not a GTM container
  • no container source: neither url nor gtm_id for scan_url, or none of url, gtm_id and data for evaluate_rule and get_health_score
  • a bad value inside a or b of compare_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.

HTTPJSON-RPC codeCause
400-32700The body is not valid JSON.
400-32600No method, or a jsonrpc version other than "2.0".
400-32602tools/call without a tool name.
401-32600Missing or invalid token. The response has a WWW-Authenticate header so the client can sign in again.
401noneA notification (a message with no id) with a missing or invalid token. The body is empty. The WWW-Authenticate header is still set.
404-32601Unknown method.
405noneAn HTTP method other than POST, GET or OPTIONS. The body is plain JSON: { "error": "Method not allowed" }.
413-32600Body over 10 MB.
500-32603The 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 envelope
{
  "error": "No GTM container ID found in page HTML"
}
429 — rate limit
{
  "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"
}
401 — auth failure
{
  "error": "Invalid or revoked API key"
}
MCP — bad argument
{
  "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."
  }
}
MCP — tool failure
{
  "jsonrpc": "2.0",
  "id": 4,
  "result": {
    "content": [
      { "type": "text", "text": "Rule not found: not-a-rule" }
    ],
    "isError": true
  }
}