# Cant get content value from container file

**URL:** <https://discourse.nodered.org/t/cant-get-content-value-from-container-file/95263>\
**Category:** General\
**Tags:** docker\
**Created:** [9 February 2025 16:46 UTC](https://discourse.nodered.org/t/cant-get-content-value-from-container-file/95263 "2025-02-09T16:46:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![yusufscelik](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yusufscelik/32/98689_2.png) [@yusufscelik](https://discourse.nodered.org/u/yusufscelik)\
**Post date:** [9 February 2025 16:46 UTC](https://discourse.nodered.org/t/cant-get-content-value-from-container-file/95263/1 "2025-02-09T16:46:49Z")

</div>

i changed the default **settings.js** to save variables in file system. i do it in this way

```auto
var value = 1;
context.set('value',value,"file"); // ✅ Store value in context

msg.payload = {
    "value": value
};
return msg;

```

i can see them also in docker container.

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/2/72862670ad6da03f3b4d999ea2c1299ea56e8d17.png)

but when i try to get the value from file system i get _undefined._

function node for getting value from file looks like this

```auto
var value = context.get("value","file"); //without file also didnt work
msg.payload = {
    "value": value
}  
return msg;

```

as returned msg.payload object i become;

```auto
msg.payload : Object

object

value: undefined

```

why cant i get the value which is saved in container?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [9 February 2025 17:08 UTC](https://discourse.nodered.org/t/cant-get-content-value-from-container-file/95263/2 "2025-02-09T17:08:54Z")

</div>

> [@yusufscelik](#):
>
> why cant i get the value which is saved in container?

Does it fetch the value if you do it without restarting node-red, or is it only after a restart that it fails?

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [9 February 2025 17:29 UTC](https://discourse.nodered.org/t/cant-get-content-value-from-container-file/95263/3 "2025-02-09T17:29:56Z")

</div>

Is this in the same function node as context is node based.

If you alter the function node the context for the node is deleted.

Try with flow context

---

<div class="post-metadata">

**Author:** ![yusufscelik](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yusufscelik/32/98689_2.png) [@yusufscelik](https://discourse.nodered.org/u/yusufscelik)\
**Post date:** [9 February 2025 17:42 UTC](https://discourse.nodered.org/t/cant-get-content-value-from-container-file/95263/5 "2025-02-09T17:42:24Z")

</div>

It didnt work even i restart or not. The solution was using flow.get, flow.set instead of using content.get content.set

---

<div class="post-metadata">

**Author:** ![yusufscelik](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yusufscelik/32/98689_2.png) [@yusufscelik](https://discourse.nodered.org/u/yusufscelik)\
**Post date:** [9 February 2025 17:43 UTC](https://discourse.nodered.org/t/cant-get-content-value-from-container-file/95263/6 "2025-02-09T17:43:02Z")

</div>

i dont know why but it worked with flow.get, flow.set. Thanks

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [9 February 2025 17:57 UTC](https://discourse.nodered.org/t/cant-get-content-value-from-container-file/95263/7 "2025-02-09T17:57:08Z")

</div>

> [@yusufscelik](#):
>
> i dont know why but it worked with flow.get, flow.set.

As said  
Context is node specific if you rewrite the function node the context is reset. You can only retrieve context from the function node that saved it, unless you alter that function node and redeploy.  
Flow is flow specific, so is not reset when you alter the function node.  
[https://nodered.org/docs/user-guide/context](https://nodered.org/docs/user-guide/context)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [23 February 2025 17:57 UTC](https://discourse.nodered.org/t/cant-get-content-value-from-container-file/95263/8 "2025-02-23T17:57:08Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
