{"record":{"id":"f8cec015b39fbf9b","repo":"gatsbyjs/gatsby","slug":"no-list-of-apis-was-given-to-remove-check-your-pl","errorCode":null,"errorMessage":"No list of APIs was given to remove, check your plugin options.","messagePattern":"No list of APIs was given to remove, check your plugin options\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby/src/utils/babel/babel-plugin-remove-api.ts","lineNumber":18,"sourceCode":"import { declare } from \"@babel/helper-plugin-utils\"\nimport * as t from \"@babel/types\"\nimport type { PluginObj, ConfigAPI, NodePath } from \"@babel/core\"\nimport { removeExportProperties } from \"./babel-module-exports-helpers\"\n\n/**\n * Remove specified module exports from files.\n */\nexport default declare(function removeApiCalls(\n  api: ConfigAPI,\n  options: { apis?: Array<string> }\n): PluginObj {\n  api.assertVersion(7)\n\n  const apisToRemove = options?.apis ?? []\n\n  if (!apisToRemove.length) {\n    console.warn(\n      `No list of APIs was given to remove, check your plugin options.`\n    )\n  }\n\n  return {\n    name: `remove-api`,\n    visitor: {\n      Program: {\n        exit(path, state): void {\n          if (!state.apiRemoved) {\n            return\n          }\n\n          // babel doesn't remove references very well so we loop until nothing gets removed\n          let removed = false\n\n          // remove all unreferenced bindings\n          do {","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/e85d62f1779e353eaac1753211629a26d123e26c/packages/gatsby/src/utils/babel/babel-plugin-remove-api.ts#L1-L36","documentation":"Guard in babel-plugin-remove-api: the babel plugin was configured with an empty or missing `apis` option, so there is no list of APIs to strip and the plugin does nothing. The input at fault is the plugin options object passed to the babel config.","triggerScenarios":"Thrown at packages/gatsby/src/utils/babel/babel-plugin-remove-api.ts:18 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the apis option, e.g. options: { apis: [\"sourceNodes\"] }, in the babel plugin configuration","Remove the plugin entirely if no API removal is needed","Verify the babel config file actually merges the plugin options"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e85d62f1779e353eaac1753211629a26d123e26c","analyzedAt":"2026-08-26T17:50:09.662Z","contentChangedAt":"2026-08-26T17:50:09.662Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}