You probably missed something with copy/pasting the error, because it doesn’t say anything about the error itself, but I think the issue is that you return the status map instead of the complete state.
If you want to update nested maps, you can use the put_in or update_in functions.
Seconding @hubertlepicki’s comment, it would be helpful if you provided the full error.
Based on context however, you have a pattern in your anonymous function that is %{stream: stream, status: %{total: total, entries: entries}} = state. The error is that the state does not meat this pattern.
This is likely because %{state.status | :entries => entries + 1} does not return the state, it returns the updated status map. you want to use put_in for updating deeply within a nested map.
There’s an answer I can give, but I think it’s more important that you try to use some basic debugging techniques to find out what is wrong. Do you know what the result of put_in state, ["status", :processed_entries], processed_entries + just_processed_entries is? Did you try to find out? If so, how?
EDIT: I see I misinterpreted the remark about the state not being changed. See the answer from @benwilson512
Since Elixir’s variables are immutable, every update in a data structure creates a new copy. This means that if a child element is updated in a nested data structure, the parent is updated too. So in this case the state is changed because you updated its status.
BTW, Elixir also provides put_in and update_in macro’s for slightly more convenient syntax. Using the put_in macro you can write this:
"status" is not the same as :status. Your put_in is using strings. You may want to become familiar with basic elixir datatypes before trying to use agents.