> For the complete documentation index, see [llms.txt](https://docs.envio.dev/llms.txt).

# Reserved Words in Envio

## Overview

A few names can't be used for contracts, events, entities or enums, because the code Envio generates looks them up on plain JavaScript objects. Using one makes codegen fail before the indexer starts.

Since v3.9 the list is short. JavaScript, TypeScript and ReScript keywords such as `class`, `interface` or `type` are allowed, because Envio capitalizes the identifiers it generates. Before v3.9, those keywords were reserved too.

## Reserved Names

These names are reserved for contract and event names in `config.yaml`, and for entity names, enum names and enum values in `schema.graphql`:

```
__defineGetter__, __defineSetter__, __lookupGetter__, __lookupSetter__,
__proto__, constructor, hasOwnProperty, isPrototypeOf,
propertyIsEnumerable, toLocaleString, toString, valueOf, enum
```

The first twelve are the properties every JavaScript object inherits from `Object.prototype`. `enum` is reserved because entities are re-exported from the `envio` module under their capitalized names, where `Enum` is already taken.

## Other Naming Rules

- Contract and event names must contain only letters, digits and underscores, and can't start with a digit.
- Entity fields can't map to a database column starting with `envio_`, which is reserved for internal columns.
- With [per-chain entities](/docs/HyperIndex/multichain-indexing#per-chain-data-mode), the field names `chainId` and `chain_id` are reserved for the chain column.

## Error Messages

A reserved name in `config.yaml`:

```
The config contains reserved words for contract names: "valueOf". They are used for the generated code and must be valid identifiers, containing only alphanumeric characters and underscores.
```

The same message names `event` instead of `contract` for an event name. A reserved name in `schema.graphql`:

```
Schema contains the following reserved keywords: toString
```

## How to Fix Reserved Word Errors

1. Rename the identifiers listed in the error.
2. Update every reference to them in your handlers and tests.
3. Run `pnpm codegen` to check the result.

### Example

```yaml
# config.yaml
contracts:
  - name: valueOf # Error: reserved
    abi_file_path: ./abis/MyContract.json
```

```yaml
# Fixed config.yaml
contracts:
  - name: ValueOracle # Good: not reserved
    abi_file_path: ./abis/MyContract.json
```

If you encounter persistent issues with reserved words or need help refactoring your schema to avoid them, please reach out for support on our [Discord community](https://discord.gg/envio).

---
