---
title: 'CHR0084: Event type generation is missing a migrator'
editUrl: https://github.com/Cratis/Chronicle/edit/main/Documentation/code-analysis/CHR0084.mdx
description: Chronicle rule CHR0084 reports missing migrators between consecutive generations of an event type and shows how to complete the migration chain.
lastUpdated: 2026-11-26T00:00:00.000Z
---

## Rule Description

An event type marked `[EventType(generation: N)]` with `N >= 2` needs an `EventTypeMigration<TUpgrade, TPrevious>` for **every** consecutive generation step from 1 up to `N`: `1->2`, `2->3`, and so on. CHR0084 reports the event type when one or more of those steps has no migrator, and the message lists exactly which steps are missing and what to add.

A step `g-1->g` is covered when a non-abstract class derives from `EventTypeMigration<TUpgrade, TPrevious>` (or implements `IEventTypeMigrationFor<TUpgrade, TPrevious>`) where `TUpgrade` is generation `g` and `TPrevious` is generation `g-1` of the same event type id. Generations are recognized for both declaration styles: `[EventTypeGenerationFor<T>(g)]` and the older explicit-id `[EventType("id", g)]` on both records. Migrators in referenced assemblies count.

Event types registered explicitly through `ExplicitArtifacts` carry no attributes and are not checked by this rule.

## Severity

Error

## Example

### Violation

**C#**

```csharp
using Cratis.Chronicle.Events;

// Error CHR0084: generation 2 has no migrator for step 1->2.
[EventType("chr0084-person-registered", generation: 2)]
public record Chr0084PersonRegistered(string FirstName, string LastName);
```

[View C# snippet source on GitHub](https://github.com/Cratis/Chronicle/blob/main/Documentation/client-snippets/code-analysis/chr0084/violation.md)

### Fix

**C#**

```csharp
using Cratis.Chronicle.Events;
using Cratis.Chronicle.Events.Migrations;

[EventType("chr0084-fix-person-registered", generation: 2)]
public record Chr0084FixPersonRegistered(string FirstName, string LastName);

[EventTypeGenerationFor<Chr0084FixPersonRegistered>(1)]
public record Chr0084FixPersonRegisteredV1(string Name);

public class Chr0084FixPersonRegisteredV1ToChr0084FixPersonRegisteredMigration
    : EventTypeMigration<Chr0084FixPersonRegistered, Chr0084FixPersonRegisteredV1>
{
    public override void Upcast(IEventMigrationBuilder<Chr0084FixPersonRegistered, Chr0084FixPersonRegisteredV1> builder) =>
        builder.Properties(pb => pb
            .Split(m => m.FirstName, e => e.Name, PropertySeparator.Space, SplitPartIndex.First)
            .Split(m => m.LastName, e => e.Name, PropertySeparator.Space, SplitPartIndex.Second));

    public override void Downcast(IEventMigrationBuilder<Chr0084FixPersonRegisteredV1, Chr0084FixPersonRegistered> builder) =>
        builder.Properties(pb => pb
            .Combine(m => m.Name, PropertySeparator.Space, e => e.FirstName, e => e.LastName));
}
```

[View C# snippet source on GitHub](https://github.com/Cratis/Chronicle/blob/main/Documentation/client-snippets/code-analysis/chr0084/fix.md)

## How To Fix It

For each missing step `g-1->g` listed in the diagnostic:

1. Make sure a record exists for generation `g-1`. If it does not, declare it with the properties generation `g-1` had, marked `[EventTypeGenerationFor<TCurrent>(g-1)]`. Do the same for generation `g` when it is not the current type.
2. Add a class deriving from `EventTypeMigration<TUpgrade, TPrevious>` (namespace `Cratis.Chronicle.Events.Migrations`) and implement `Upcast` and `Downcast` to map between the two shapes. See [Event type migrations](/chronicle/migrations/dotnet-client/) for the available builders.

Do not silence the error by lowering the generation number: events already stored at earlier generations must be upcast. Lower it only when the new generation has never been deployed anywhere.

## Why This Rule Exists

Chronicle validates the migration chain when event types are registered. A generation that has no migrator for every step makes the kernel reject the event type (`MissingEventTypeMigrators` or `MissingMigrationForEventTypeGeneration`), so the application fails at startup — or, in a development image with validation relaxed, stored events of the older shape are never upcast. This rule moves that failure to build time, where the fix is a few lines in the same project. See [event generation validation](/chronicle/migrations/validation/) for the full chain rules.

## Related Rules

- [CHR0037](/chronicle/code-analysis/chr0037/): Event type migration generations must belong to one event type.
- [CHR0049](/chronicle/code-analysis/chr0049/): `[EventTypeGenerationFor<T>]` must reference a type marked with `[EventType]`.
