Build Error (BUILD_ERROR)

Applies to
Gatewayruntime for API, AI, and MCP gateways
Hosting
Managed EdgeManaged DedicatedSelf-Hosted

There was an error building your project. The gateway returns this error when the project fails to compile during deployment.

Common causes

  • TypeScript errors - Type mismatches, missing type definitions, or invalid TypeScript syntax prevent the project from compiling.
  • Missing imports - A module or package referenced in the code is not installed or does not exist.
  • Invalid route configuration - The routes.oas.json file contains syntax errors or references policies or handlers that do not exist.
  • Missing export - A policy or route handler refers to an export that its module doesn't contain. See Missing export.
  • Schema errors in policies.json and routes - A value in config/policies.json or in a route's x-zuplo-route doesn't match the expected format. See Schema errors in policies.json and routes.
  • Incompatible dependencies - A package dependency has version conflicts or is not compatible with the Zuplo runtime.

Missing export

If the export of a policy in config/policies.json, or of a route handler, isn't in the module that module names, the build fails. The error names the export, the module, and the policy:

Code
Could not find export "McpCapabilityFilterInboundPolicy" in '@zuplo/runtime' for policy 'mcp-capability-filter-inbound' at /policies/0/handler in /config/policies.json. It is exported from '@zuplo/runtime/mcp-gateway'; set "module" to "$import(@zuplo/runtime/mcp-gateway)".

To fix it:

  • Check the spelling and capitalization of export. When a similar name exists in the module, the error suggests it (Did you mean 'MyPolicy'?).
  • If the export lives in a different entry point of the same package, the error names it. Change module to that entry point. For example, policies for the MCP Gateway come from $import(@zuplo/runtime/mcp-gateway), not from $import(@zuplo/runtime).
  • For a custom module, make sure the file exports the name and compiles without errors.

A policy that no route uses only produces a warning, because nothing calls it yet. The build fails as soon as a route uses that policy.

Schema errors in policies.json and routes

The build validates config/policies.json and the x-zuplo-route of every route in your OpenAPI files. Each error names the file and the JSON pointer of the invalid value, and quotes the value when it's short:

Code
Must match pattern "^[0-9a-z-]+$". Found "$env(POLICY_NAME)" at /policies/0/name in /config/policies.json.
Code
Value of property 'corsPolicy' must be 'string'. Found 42 at /paths/~1todos~1{id}/get/x-zuplo-route/corsPolicy in ./config/routes.oas.json.

Use the pointer to find the value. In the first example, /policies/0/name is the name of the first entry in policies. Fix the value so that it matches the format the message describes.

$env() is only allowed in some locations. Using it in a policy name, for example, produces a schema error like the first one above.

How to access build logs

  1. Open the Zuplo portal and navigate to the project.
  2. Check the deployment logs for detailed error messages and stack traces.
  3. For local development, run the build locally to see the full error output.

How to fix

  1. Read the error message carefully. Build errors typically include the file name, line number, and a description of the issue.
  2. Fix any TypeScript compilation errors by checking types and imports.
  3. Verify that all referenced modules are listed in package.json and properly installed.
  4. Validate the routes.oas.json file to ensure all handler and policy references are correct.

Run builds locally before deploying to catch errors early. See Local Development for setup instructions.

Last modified on