---
title: 'CHR0055: Unknown event stream on typed event source filter'
editUrl: https://github.com/Cratis/Chronicle/edit/main/Documentation/code-analysis/CHR0055.mdx
description: CHR0055 reports a [FromEventSource<TSource>] filter that names a stream the event source definition does not declare.
---

import { Tabs, TabItem } from '@astrojs/starlight/components';


## Rule description

`[FromEventSource<TSource>("stream")]` makes a reactor or reducer handle only the events of one stream of an event source definition. The stream name must be one that `TSource` declares with `[EventStream]`. If it is not, the client throws `EventStreamDoesNotBelongToEventSource` when it registers the observer, so the application fails at start up.

CHR0055 reports the same mistake when you compile. The names are compared exactly, including the casing.

## Severity

Error

## Example

<Tabs syncKey="chronicle-client">
<TabItem label="C#">

```csharp
using Cratis.Chronicle.Events;
using Cratis.Chronicle.EventSources;
using Cratis.Chronicle.Reactors;

[EventType]
public record Chr0055PaymentReceived(decimal Amount);

[EventSource("Order")]
[EventStream("Payments")]
public class Chr0055OrderEventSource : IEventSource;

// Error CHR0055: Chr0055OrderEventSource does not declare an event stream named "Payment".
[FromEventSource<Chr0055OrderEventSource>("Payment")]
public class Chr0055PaymentReactor : IReactor
{
    public Task Received(Chr0055PaymentReceived @event, EventContext context) => Task.CompletedTask;
}
```

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

</TabItem>
</Tabs>

## How to fix

Use the name of a declared stream, or declare the stream on the definition.

<Tabs syncKey="chronicle-client">
<TabItem label="C#">

```csharp
using Cratis.Chronicle.Events;
using Cratis.Chronicle.EventSources;
using Cratis.Chronicle.Reactors;

[EventType]
public record Chr0055FixPaymentReceived(decimal Amount);

[EventSource("Order")]
[EventStream("Payments")]
public class Chr0055FixOrderEventSource : IEventSource;

// The stream name matches the declared stream exactly.
[FromEventSource<Chr0055FixOrderEventSource>("Payments")]
public class Chr0055FixPaymentReactor : IReactor
{
    public Task Received(Chr0055FixPaymentReceived @event, EventContext context) => Task.CompletedTask;
}
```

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

</TabItem>
</Tabs>

## Why this rule exists

The stream name is a string in an attribute argument, so the compiler cannot check it. Without the rule a typo ships and surfaces as a crash at start up. The rule moves the failure to the line that has the typo.

## Related topics

- [Filter observers by event source and stream](/chronicle/event-sources/filtering/)
- [Define an event source](/chronicle/event-sources/defining/)
- [CHR0056](/chronicle/code-analysis/chr0056/): explicit routing contradicts a typed event source filter.
- [Dynamic Consistency Boundary in Chronicle](/chronicle/dynamic-consistency-boundary/chronicle/): streams are one of the dimensions a decision's guard can narrow to.
