{"record":{"id":"328e90bf6675088c","repo":"twentyhq/twenty","slug":"failed-to-introspect-core-schema-json-stringify","errorCode":null,"errorMessage":"Failed to introspect core schema: ${JSON.stringify(coreSchemaResponse.error)}","messagePattern":"Failed to introspect core schema: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/twenty-sdk/src/cli/utilities/client/client-service.ts","lineNumber":34,"sourceCode":"      serverUrl: options?.serverUrl,\n      skipAuth: options?.skipAuth ?? true,\n      token: options?.token,\n    });\n  }\n\n  async generateCoreClient({\n    appPath,\n    appAccessToken,\n  }: {\n    appPath: string;\n    appAccessToken?: string;\n  }): Promise<void> {\n    const coreSchemaResponse = await this.apiService.getSchema({\n      appAccessToken,\n    });\n\n    if (!coreSchemaResponse.success) {\n      throw new Error(\n        `Failed to introspect core schema: ${JSON.stringify(coreSchemaResponse.error)}`,\n      );\n    }\n\n    await replaceCoreClient({\n      packageRoot: join(appPath, 'node_modules', 'twenty-client-sdk'),\n      schema: coreSchemaResponse.data,\n    });\n  }\n}\n","sourceCodeStart":16,"sourceCodeEnd":45,"githubUrl":"https://github.com/twentyhq/twenty/blob/1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6/packages/twenty-sdk/src/cli/utilities/client/client-service.ts#L16-L45","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure a valid appAccessToken is available — re-authenticate if needed.","Verify the serverUrl points to a Twenty instance that has GraphQL introspection enabled (development/staging typically, not production).","Check network connectivity to the server (curl the /graphql endpoint manually).","Inspect the JSON-stringified error in the message for the specific failure reason.","Ensure the Twenty server version is compatible with the SDK CLI version."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await clientService.generateCoreClient({ appPath, appAccessToken });\n} catch (error) {\n  if (error instanceof Error && error.message.startsWith('Failed to introspect core schema')) {\n    console.error('Schema introspection failed. Check: token validity, server URL, introspection enabled.');\n    console.error('Detail:', error.message);\n    process.exit(1);\n  }\n  throw error;\n}","preventionTips":["Ensure a valid appAccessToken is set before generating the client.","Verify the target server has GraphQL introspection enabled.","Check network connectivity and server availability before running code generation."],"tags":["sdk-cli","graphql","introspection","code-generation","network"],"backgroundTag":null,"analyzedSha":"1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6","analyzedAt":"2026-08-12T15:37:27.593Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}