Errors and troubleshooting
GraphQL error codes, null fields and diagnostic practices
Understanding error handling in the Ballpark GraphQL API
The Ballpark API employs a dual-layer error system that provides both GraphQL-level errors and operation-specific errors. This design ensures you receive detailed, actionable information when something goes wrong, while maintaining the flexibility and type safety that GraphQL provides.
Error response structure
A typical GraphQL response from the Ballpark API may contain errors in two distinct locations:
GraphQL-level errors
GraphQL-level errors appear in the top-level errors
array and indicate issues with the request itself, authentication, or server-level problems. These errors prevent the operation from executing entirely.
Authentication and scope errors
When your access token is missing, expired, or lacks the required scopes, you'll receive an error in the errors
array:
Common authentication errors:
Missing required scopes: (scope:name)
— Your token lacks the necessary OAuth scope for this operationOAuth2 token expired or invalid
— Your access token has expired or is malformed
Resolution: Ensure your access token includes all required scopes for the operation you're attempting. Refer to our Authentication guide for obtaining properly scoped tokens.
Validation errors
Input validation failures occur when the structure or content of your request doesn't meet the API's requirements:
Resolution: Verify that all required fields are present and that data types match the schema definition. Use introspection or our schema documentation to validate your query structure.
Server errors
In rare cases, an unexpected server error may occur:
Resolution: If you consistently encounter this error, contact our support team with the full request details and timestamp.
Operation-specific errors
When an operation executes successfully but encounters a business logic constraint, the error appears within the mutation's response data. These errors are operation-specific and include a typed error code alongside a descriptive message.
Standard error structure
Most mutations follow this response pattern:
Key fields:
ok
(Boolean) — Indicates whether the operation succeededuserTest
(Object or null) — The created resource on success,null
on failureerror
(Object or null) — Contains error details ifok
isfalse
code
(Enum) — A machine-readable error codemessage
(String) — A human-readable error description
Using error codes
Error codes are enumerated values that allow your application to handle specific error conditions programmatically:
Common error codes
While each mutation defines its own error codes, several patterns recur throughout the API:
Permission and access
PERMISSION_DENIED
— Your account lacks permission to perform this actionUNAUTHORIZED
— Authentication is required or credentials are invalid
Resource management
PROJECT_DOES_NOT_EXIST
/PROJECT_NOT_FOUND
— The requested project doesn't existSCREEN_NOT_FOUND
— The requested screen doesn't existINVALID_TARGET_FOLDER
— The specified folder doesn't existUNAUTHORIZED_TARGET_FOLDER
— You don't have access to the specified folder
Validation
VALIDATION_ERROR
— Input data failed validation rulesINVALID_INPUT
— Input structure or content is malformedMISSING_ARGUMENTS
— Required parameters were not providedINVALID_GOAL_SCREEN
— The goal screen specified is not validBROKEN_SCREENS
— The test project contains broken screens that must be fixed
Quota and limits
QUOTA_REACHED
— Account has reached its usage limit for this resource
State conflicts
PROJECT_IS_ARCHIVED
— Cannot perform this operation on an archived projectREADONLY_PROJECT
— The project is read-only and cannot be modified
Integration errors
EXTERNAL_PROTOTYPE_IMPORT_FAILED
— Failed to import the remote projectEXTERNAL_PROTOTYPE_UNAUTHORISED_ACCESSS
— You lack permission to access the remote projectEXTERNAL_PROTOTYPE_NOT_FOUND
— The remote file could not be found
Batch operations and partial failures
Some mutations operate on multiple items simultaneously. These return succeeded
and failed
arrays to indicate which items were processed successfully:
This pattern allows your application to handle partial success gracefully—you can confirm which operations completed while addressing any failures:
Usability Testing Steps
STEP_PROTOTYPE_TASK
— Tests a specific task within a prototype
STEP_WEBSITE_TASK
— Tests a task performed on a live website
STEP_FIRST_CLICK
— Tests what a participant is likely to click first on a screen
STEP_FIVE_SECOND_TEST
— Checks a participant's response after viewing an image for five seconds
Marketing and Design Steps
STEP_PREFERENCE_TEST
— Allows participants to select their preference from a set of options
STEP_BANNER_AD_TEST
— Tests the effectiveness of banner ad copy
STEP_TAGLINE_COPY_TEST
— Tests the effectiveness of tagline or copy text
Card Sorting Steps
STEP_CARDSORT_OPEN
— Participants sort cards into categories they create themselves
STEP_CARDSORT_CLOSED
— Participants sort cards into predefined categories
STEP_CARDSORT_HYBRID
— Participants sort cards into predefined categories or create new ones
AI-Powered Steps
STEP_AI_INTERVIEW
— An AI-moderated interview where the AI asks dynamic follow-up questions based on participant responses
Queries can also return errors when resources don't exist or you lack permission to access them:
If the user test doesn't exist or you lack access, you'll receive a GraphQL-level error:
Best practices
1. Always check both error locations
Your error handling should account for both GraphQL-level errors and operation-specific errors:
2. Use error codes for conditional logic
Rely on error code
values rather than parsing error messages, as codes are stable across API versions:
3. Provide context in error messages
When displaying errors to users, combine the error message with operation context:
4. Log full error details
For debugging purposes, log complete error objects including any additional context fields:
5. Handle authentication errors globally
Authentication and scope errors typically require the same response regardless of operation. Consider handling these at a global level in your application:
6. Handle quota errors gracefully
When users hit quota limits, provide clear upgrade paths:
Introspecting error types
The Ballpark GraphQL schema includes full type definitions for all error objects. You can use introspection to discover available error codes for any mutation:
This returns all possible error codes and their descriptions:
Further assistance
If you encounter errors that aren't covered in this guide, or if you believe you've found an issue with the API, please contact us with:
The full GraphQL query or mutation
The complete error response
Your request timestamp
Any relevant identifiers (project PK, user test UUID, etc.)