twentyhq/twenty · error · Error

Failed to introspect core schema: ${JSON.stringify(coreSchem

Error message

Failed to introspect core schema: ${JSON.stringify(coreSchemaResponse.error)}

What it means

Thrown by ClientService.generateCoreClient when the getSchema (GraphQL introspection) call to the Twenty server fails. This function introspects the core GraphQL schema and generates a typed client SDK via replaceCoreClient. A failure means the schema could not be retrieved, preventing client code generation.

Source

Thrown at packages/twenty-sdk/src/cli/utilities/client/client-service.ts:34

      serverUrl: options?.serverUrl,
      skipAuth: options?.skipAuth ?? true,
      token: options?.token,
    });
  }

  async generateCoreClient({
    appPath,
    appAccessToken,
  }: {
    appPath: string;
    appAccessToken?: string;
  }): Promise<void> {
    const coreSchemaResponse = await this.apiService.getSchema({
      appAccessToken,
    });

    if (!coreSchemaResponse.success) {
      throw new Error(
        `Failed to introspect core schema: ${JSON.stringify(coreSchemaResponse.error)}`,
      );
    }

    await replaceCoreClient({
      packageRoot: join(appPath, 'node_modules', 'twenty-client-sdk'),
      schema: coreSchemaResponse.data,
    });
  }
}

View on GitHub (pinned to 1f5dd2bbd2)

Solutions

  1. Ensure a valid appAccessToken is available — re-authenticate if needed.
  2. Verify the serverUrl points to a Twenty instance that has GraphQL introspection enabled (development/staging typically, not production).
  3. Check network connectivity to the server (curl the /graphql endpoint manually).
  4. Inspect the JSON-stringified error in the message for the specific failure reason.
  5. Ensure the Twenty server version is compatible with the SDK CLI version.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await clientService.generateCoreClient({ appPath, appAccessToken });
} catch (error) {
  if (error instanceof Error && error.message.startsWith('Failed to introspect core schema')) {
    console.error('Schema introspection failed. Check: token validity, server URL, introspection enabled.');
    console.error('Detail:', error.message);
    process.exit(1);
  }
  throw error;
}

Prevention

When it happens

Trigger: apiService.getSchema returns { success: false } — this wraps a GraphQL introspection query that failed due to network issues, auth errors, server-side introspection being disabled, or the API returning an error response.

Common situations: The app access token is expired or missing. The serverUrl points to an instance that has GraphQL introspection disabled (common in production). Network connectivity issues between the CLI and the Twenty server. The Twenty server version doesn't support the introspection query format used by the SDK.

Related errors


AI-assisted analysis of twentyhq/twenty@1f5dd2bbd2 (2026-08-12). Data as JSON: /api/errors/328e90bf6675088c. Report an issue: GitHub.