# Zuplo Main Module Error (MAIN_MOD_ERROR)

There was an error loading your Zuplo project. This error occurs at runtime when
the project builds successfully but fails to initialize.

## Common causes

- **Runtime extension errors** - Code in a runtime extension throws an error
  during initialization. This includes errors in the `runtimeInit` or other
  lifecycle hooks.
- **Invalid module exports** - A module does not export the expected functions
  or objects that the Zuplo runtime requires.
- **Unhandled exceptions at startup** - Top-level code in a module throws an
  exception when the module is first loaded.
- **Missing environment variables** - Code references an environment variable
  that is not set, causing a failure during module initialization.

## How to debug

1. Check the runtime logs in the Zuplo portal for detailed error messages and
   stack traces.
2. Review any runtime extensions for errors in initialization code.
3. Verify that all environment variables referenced in the code are configured
   in the current environment.
4. Test the project locally to reproduce the error with full debug output.

:::warning

This error prevents the entire project from loading. All routes return this
error until the underlying issue is resolved and the project is redeployed.

:::

## Related resources

- [Runtime Extensions](../programmable-api/runtime-extensions.mdx)
- [Environment Variables](../articles/environment-variables.mdx)
- [Logging](../articles/logging.mdx)
