Skip to content

CHR0064: Invalid read model event stream

A per-stream read model must name one stream declared by an IEventSource definition and keep the event source ID as its model key. It is implicitly passive and cannot be reducer-backed.

DeclarationDiagnostic
[EventStream<TSource>(stream)] names an undeclared stream, an empty stream or AllError
Non-generic [EventStream(stream)] on a type that is not an IEventSourceError; the attribute would not scope a read model
Generic [EventStream<TSource>(stream)] on an IEventSourceError; use the non-generic declaration there
Generic attribute on a self-reducing model, a classic reducer, or a model with a visible IReducerFor<T>Error; reducers cannot fold one stream
Fluent UsingKeyFromContext(context => context.EventStreamId) on the declared modelError; a month alone collides across owners

The analyzer reports statically visible declarations and stream-key mappings. Runtime registration validates the declaration and the projection’s root key as well.

Error

Put the non-generic attribute from Cratis.Chronicle.EventSources on the event source definition. Put the generic attribute from Cratis.Chronicle.ReadModels on a source-keyed projection model and name a stream the definition declares. Remove stream-key redirection and reducer handlers from that model. Keep a separate whole-source reducer if you need one.

The monthly-limit example shows both attributes together and the stream-aware reads. There is no automatic code fix: choosing which history defines a rule is a correctness decision.