---
title: 'CHR0005: Reactor event parameter must have [EventType] attribute'
---

## Rule Description

Event parameters in reactor methods must be types marked with the `[EventType]` attribute. This ensures that reactors only handle properly identified event types.

## Severity

Error

## Example

### Violation

```csharp
// Missing [EventType] attribute
public record CustomerRegistered(Guid CustomerId, string Email);

public class CustomerReactor : IReactor
{
    // CHR0005: Type 'CustomerRegistered' must be marked with [EventType] attribute
    public async Task Registered(CustomerRegistered @event)
    {
        // Send welcome email
        await SendWelcomeEmail(@event.Email);
    }
}
```

### Fix

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

[EventType]
public record CustomerRegistered(Guid CustomerId, string Email);

public class CustomerReactor : IReactor
{
    // Now valid
    public async Task Registered(CustomerRegistered @event)
    {
        // Send welcome email
        await SendWelcomeEmail(@event.Email);
    }
}
```

## Quick Fix

The analyzer provides a code fix that automatically adds the `[EventType]` attribute to the event parameter type.

## Why This Rule Exists

Reactors handle side effects when events occur. Ensuring all event types are properly marked:
- Guarantees proper event routing to reactors
- Enables type-safe event handling
- Ensures events are correctly serialized/deserialized
- Maintains schema tracking for events

## Related Rules

- [CHR0001](/chronicle/code-analysis/chr0001/): Event sequence append operations
- [CHR0004](/chronicle/code-analysis/chr0004/): Reactor method signatures
- [CHR0007](/chronicle/code-analysis/chr0007/): Reducer event parameters
