gatsbyjs/gatsby · error

No list of APIs was given to remove, check your plugin optio

Error message

No list of APIs was given to remove, check your plugin options.

What it means

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.

Source

Thrown at packages/gatsby/src/utils/babel/babel-plugin-remove-api.ts:18

import { declare } from "@babel/helper-plugin-utils"
import * as t from "@babel/types"
import type { PluginObj, ConfigAPI, NodePath } from "@babel/core"
import { removeExportProperties } from "./babel-module-exports-helpers"

/**
 * Remove specified module exports from files.
 */
export default declare(function removeApiCalls(
  api: ConfigAPI,
  options: { apis?: Array<string> }
): PluginObj {
  api.assertVersion(7)

  const apisToRemove = options?.apis ?? []

  if (!apisToRemove.length) {
    console.warn(
      `No list of APIs was given to remove, check your plugin options.`
    )
  }

  return {
    name: `remove-api`,
    visitor: {
      Program: {
        exit(path, state): void {
          if (!state.apiRemoved) {
            return
          }

          // babel doesn't remove references very well so we loop until nothing gets removed
          let removed = false

          // remove all unreferenced bindings
          do {

View on GitHub (pinned to e85d62f177)

Solutions

  1. Pass the apis option, e.g. options: { apis: ["sourceNodes"] }, in the babel plugin configuration
  2. Remove the plugin entirely if no API removal is needed
  3. Verify the babel config file actually merges the plugin options
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/gatsby/src/utils/babel/babel-plugin-remove-api.ts:18 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of gatsbyjs/gatsby@e85d62f177 (2026-08-26). Data as JSON: /api/errors/f8cec015b39fbf9b. Report an issue: GitHub.