# Flows don't start: \`\[warn\] Error loading flows: TypeError: Cannot read property 'hasOwnProperty' of undefined\`

**URL:** <https://discourse.nodered.org/t/flows-dont-start-warn-error-loading-flows-typeerror-cannot-read-property-hasownproperty-of-undefined/47221>\
**Category:** General\
**Created:** [16 June 2021 07:58 UTC](https://discourse.nodered.org/t/flows-dont-start-warn-error-loading-flows-typeerror-cannot-read-property-hasownproperty-of-undefined/47221 "2021-06-16T07:58:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tfr](https://avatars.discourse-cdn.com/v4/letter/t/6bbea6/32.png) [@tfr](https://discourse.nodered.org/u/tfr)\
**Post date:** [16 June 2021 07:58 UTC](https://discourse.nodered.org/t/flows-dont-start-warn-error-loading-flows-typeerror-cannot-read-property-hasownproperty-of-undefined/47221/1 "2021-06-16T07:58:57Z")

</div>

Hello

I am trying to setup a gitlab CI pipeline. When running starting node-red under Windows it works.  
When starting under WSL (Linux) it works. When running inside Docker it works. However, with the gitlab runner it does not.

I get the unique error:

```auto
Welcome to Node-RED
===================

15 Jun 12:42:46 - [info] Node-RED version: v1.3.5-git
15 Jun 12:42:46 - [info] Node.js version: v14.17.0
15 Jun 12:42:46 - [info] Linux 5.4.0-47-generic x64 LE
15 Jun 12:42:46 - [info] Loading palette nodes
15 Jun 12:42:52 - [info] Context store : 'memory' [module=memory]
15 Jun 12:42:52 - [info] Context store : 'filesystemCached' [module=localfilesystem]
15 Jun 12:42:52 - [info] Context store : 'filesystemDirect' [module=localfilesystem]
15 Jun 12:42:52 - [info] User directory : /builds/a/b-gateway/gateway
15 Jun 12:42:52 - [info] Projects directory: /builds/a/b-gateway/gateway/projects
15 Jun 12:42:52 - [warn] Error loading flows: TypeError: Cannot read property 'hasOwnProperty' of undefined

```

Good, case WSL2:

```auto
Welcome to Node-RED
===================

15 Jun 16:54:19 - [info] Node-RED version: v1.3.5-git
15 Jun 16:54:19 - [info] Node.js version: v14.17.0
15 Jun 16:54:19 - [info] Linux 4.4.0-19041-Microsoft x64 LE
15 Jun 16:54:21 - [info] Loading palette nodes
initialized
Server is now listening ... ( press CTRL+C to stop)
port 4334
 the primary server endpoint url is opc.tcp://LAP-16.Autexis.ch:4334/UA/Sample
15 Jun 16:54:26 - [info] Context store : 'memory' [module=memory]
15 Jun 16:54:26 - [info] Context store : 'filesystemCached' [module=localfilesystem]
15 Jun 16:54:26 - [info] Context store : 'filesystemDirect' [module=localfilesystem]
15 Jun 16:54:26 - [info] User directory : /mnt/c/dev/a/b-gateway/gateway
15 Jun 16:54:26 - [info] Projects directory: /mnt/c/dev/a/b-gateway/gateway/projects
Current project 'gateway-tests' is already active.
15 Jun 16:54:26 - [info] Active project : gateway-tests
15 Jun 16:54:26 - [info] Flows file : /mnt/c/dev/a/b-gateway/gateway/projects/gateway-tests/flow.json
15 Jun 16:54:26 - [info] Starting flows
15 Jun 16:54:26 - [info] Started flows

```

I pinpointed the error origination somewhere to there: `node_modules/@node-red/runtime/lib/flows/index.js`:

```auto
function loadFlows() {
    var config;
    return storage.getFlows().then(function(_config) {
        config = _config;
        log.debug("loaded flow revision: "+config.rev);
        return credentials.load(config.credentials).then(function() {
            events.emit("runtime-event",{id:"runtime-state",retain:true});
            return config;
        });
    }).catch(function(err) {
        if (err.code === "credentials_load_failed" && !storage.projects) {
            // project disabled, credential load failed
            credentialsPendingReset = true;
            log.warn(log._("nodes.flows.error",{message:err.toString()}));
            events.emit("runtime-event",{id:"runtime-state",payload:{type:"warning",error:err.code,text:"notification.warnings.credentials_load_failed_reset"},retain:true});
            return config;
        } else {
            activeConfig = null;
            events.emit("runtime-event",{id:"runtime-state",payload:{type:"warning",error:err.code,project:err.project,text:"notification.warnings."+err.code},retain:true});
            if (err.code === "project_not_found") {
                log.warn(log._("storage.localfilesystem.projects.project-not-found",{project:err.project}));
            } else {
                log.warn(log._("nodes.flows.error",{message:err.toString()}));
            }
            throw err;
        }
    });
}

```

Error Message: `log.warn(log._("nodes.flows.error",{message:err.toString()}));` // LL86,95

But I fail to see, how or why it does not work. Maybe something with the `flow.json`? However, it works in all other environments...

Any idea?  
Maybe also an idea, of how I could see more information about the flow loading process?

Thanks and best regards

---

<div class="post-metadata">

**Author:** ![tfr](https://avatars.discourse-cdn.com/v4/letter/t/6bbea6/32.png) [@tfr](https://discourse.nodered.org/u/tfr)\
**Post date:** [16 June 2021 08:44 UTC](https://discourse.nodered.org/t/flows-dont-start-warn-error-loading-flows-typeerror-cannot-read-property-hasownproperty-of-undefined/47221/2 "2021-06-16T08:44:51Z")

</div>

Ok..., so after a good night sleep, I tried to disable the cache. Disabeling the cache in the `.gitlab-ci.yml` solved the issue. So I guess it was no problem with node-red, and only with the gitlab cache:

```auto
image: node:14

# cache only works if we make sure, that there is one runner. otherwise every runner needs to have its own cache
#cache:
# untracked: true
# paths:
# - node_modules/

stages:
    - test

gateway_tests:
    before_script:
        - yarn install
    tags:
        - node
        - docker
    stage: test
    script:
        - yarn test

```

Since I do install everytime, i guess the cache is not really necessary

---

<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:** [30 June 2021 08:45 UTC](https://discourse.nodered.org/t/flows-dont-start-warn-error-loading-flows-typeerror-cannot-read-property-hasownproperty-of-undefined/47221/3 "2021-06-30T08:45:36Z")

</div>

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