Skip to content

Errors

GraphQL Errors

GraphQL errors follow the standard GraphQL error specification. The response includes a data field (possibly null) and an errors array:

json
{
  "data": null,
  "errors": [
    {
      "message": "You must be logged in.",
      "extensions": {
        "code": "UNAUTHENTICATED"
      },
      "path": ["lnkifyConnection"]
    }
  ]
}
FieldDescription
messageHuman-readable error description
extensions.codeMachine-readable error code
pathPath to the field that caused the error

Common Error Codes

CodeMeaning
UNAUTHENTICATEDMissing or invalid auth (401)
RATE_LIMITEDToo many requests (429)
BAD_USER_INPUTInvalid or missing input fields
NOT_FOUNDRequested resource does not exist
INTERNAL_SERVER_ERRORUnexpected server error (500)

HTTP-Level Errors

StatusMeaningTypical Cause
400Bad RequestMalformed JSON, missing required fields, invalid input
401UnauthorizedMissing/invalid JWT or API key
404Not FoundSlug doesn't exist, resource ID not found
429Too Many RequestsRate limit exceeded
500Internal Server ErrorUnhandled server exception

401 Unauthorized

json
{
  "errors": [{
    "message": "You must be logged in.",
    "extensions": { "code": "UNAUTHENTICATED" }
  }]
}

404 Not Found (slug redirect)

Plain text response on the redirect endpoint:

http
HTTP/1.1 404 Not Found
Content-Type: text/plain

Target not found

Partial Success in Bulk Operations

Bulk mutations (createLnkifies, updateLnkifies, deleteLnkifies) return an array where each item reports its own success or failure. One failed item does not abort the batch.

BulkLnkifyResult

json
{
  "data": {
    "createLnkifies": [
      { "index": 0, "ok": true, "lnkify": { "id": "1", "lnkify": "my-link" }, "error": null },
      { "index": 1, "ok": false, "lnkify": null, "error": "Target URL is required" }
    ]
  }
}
FieldTypeDescription
indexInt!Zero-based position in the input array
okBoolean!Whether this item succeeded
lnkifylnkifyThe created/updated shortlink (null on failure)
errorStringError message if failed

BulkDeleteResult

json
{
  "data": {
    "deleteLnkifies": [
      { "index": 0, "id": "1", "ok": true, "error": null },
      { "index": 1, "id": "2", "ok": false, "error": "Not authorized to delete this link" }
    ]
  }
}

MCP Errors

The MCP server returns JSON-RPC error objects:

json
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32001,
    "message": "Authentication required"
  },
  "id": null
}
JSON-RPC CodeHTTP AnalogMeaning
-32001401Authentication error
-32000400Bad request / invalid input
-32603500Internal server error

Error Handling Best Practices

  • Always check errors array even when data is present (partial failures in bulk ops)
  • Retry on 429 with exponential backoff (see Rate Limits)
  • Validate inputs client-side to avoid BAD_USER_INPUT responses
  • Handle 401 by refreshing the JWT or checking the API key
  • Log extensions.code for debugging — it's more stable than the message string

Released under the MIT License.