HomeDev GuideRecipesAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Troubleshoot Optimizely Graph errors in C# SDK

Leatn more about Optimizely Graph errors, their causes, and how to resolve them.

When a request to Optimizely Graph fails, the service returns an HTTP status code and a specific error code that describes the problem. These errors usually occur because of authentication issues, invalid queries, or content that has not yet synchronized to the Graph index.

This reference lists common errors returned by Optimizely Graph, explains their typical causes, and provides guidance on how to resolve them. Use this information to diagnose problems in your queries and configuration more quickly.

❗️

Warning

Never include API keys or secrets when sharing error details.

Common errors

400 — BAD_REQUEST

Message

Bad Request — the GraphQL request is malformed.

Possible causes

  • The GraphQL query syntax is invalid.
  • A field name is misspelled.
  • The request body is not valid JSON.
  • Required query parameters are missing.

Resolution:

  • Check the error response body for details about the failure.
  • Validate the query syntax for missing braces, parentheses, or quotation marks.
  • Confirm that all required parameters are included in the request.

404 – NOT_FOUND

Message:

Not Found — the requested endpoint or content does not exist.

Cause: The content hasn't been synchronized to Optimizely Graph yet.

Possible cause Run the Graph Full Synchronization scheduled job in CMS. Once it completes, retry your query.

500 – INTERNAL_ERROR

Message

Internal Server Error — service issues

Possible causes

  • Content Graph service is experiencing issues
  • Query complexity exceeds processing limits
  • Unexpected server-side errors

Resolution

  • Simplify the query by reducing the result set or removing complex filters.
  • If the issue persists, contact Optimizely support and include the correlation-id value from the response header.

Authentication errors

401 – GRAPH_AUTH_FAILED

Message

Authentication failed – invalid or missing API key

Possible causes

  • AppKey or Secret is not configured in appsettings.json
  • The configured keys are incorrect

Resolution

Verify that your appsettings.json (or environment variables) contain the correct values:

{
  "Optimizely": {
    "Graph": {
      "Endpoint": "https://cg.optimizely.com",
      "AppKey": "YOUR APPKEY HERE",
      "Secret": "YOUR SECRET KEY HERE"
    }
  }
}

See Authentication for credential setup.

Query errors

400 – GRAPH_QUERY_INVALID

Message:

Query validation failed — syntax errors in GraphQL query

Possible causes

  • Malformed lambda expressions in .Where() clauses
  • Invalid filter expressions or comparison operators
  • Incorrect method chaining order
  • Missing brackets or parentheses

Resolution

  • Verify all brackets and parentheses are balanced

  • Check that .Where() expressions use supported comparison operators

  • Confirm methods are chained in a valid order, such as:

    WhereOrderBySkip/LimitGetAsContentAsync

  • Build up the query step by step to identify the method causing the issue

400 – GRAPH_FIELD_UNKNOWN

Message:

Unknown field – querying non-existent properties

Possible causes

  • Field name is misspelled in the query
  • Property doesn't exist on the content type
  • Property isn't indexed in Content Graph
  • Case-sensitivity mismatch (field names are case-sensitive)

Resolution

  • Verify the exact spelling and casing of the field name.
  • Confirm that the property exists on the content type.
  • Confirm that the property is indexed in Content Graph.
  • If you recently added the property, trigger reindexing by running the Graph Full Synchronization scheduled job in CMS.