# Help on invalid use of mutating method on rvalue

**URL:** <https://forum.modular.com/t/help-on-invalid-use-of-mutating-method-on-rvalue/1274>\
**Category:** Standard Library\
**Tags:** mojo-compiler\
**Created:** [April 22, 2025, 2:33am UTC](https://forum.modular.com/t/help-on-invalid-use-of-mutating-method-on-rvalue/1274 "2025-04-22T02:33:35Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![duck\_tape](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/duck_tape/32/432_2.png) [@duck\_tape](https://forum.modular.com/u/duck_tape)\
**Post date:** [April 22, 2025, 1:28pm UTC](https://forum.modular.com/t/help-on-invalid-use-of-mutating-method-on-rvalue/1274/2 "2025-04-22T13:28:59Z")

</div>

> [@letpat](#):
>
> n I try to call a set method (set\_var) which changes data, compiler reports e

I’m not sure exactly what is the cause here, hopefully someone else can elaborate on that.

I think that one of `Dict. __getitem__ ` or `List. __getitem__ ` is actually creating a copy of the `Client`, which is the rvalue that the the message refers to. Since the rvalue isn’t bound to anything, mutating it doesn’t do anything, and that’s an error (I think my terminology here is a bit messy).

To fix it you just need to get a pointer to the dictionary value, for example:  
`d01.get_ptr("ClientA").value()[][0].set_var(4)` fixes it.

---

_[View the full topic](https://forum.modular.com/t/help-on-invalid-use-of-mutating-method-on-rvalue/1274)._
