# Unable to start the server -

**URL:** <https://community.forestadmin.com/t/unable-to-start-the-server/3256>\
**Category:** Help me!\
**Tags:** setup\
**Created:** [September 9, 2021, 6:02pm UTC](https://community.forestadmin.com/t/unable-to-start-the-server/3256 "2021-09-09T18:02:39Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![viperfx](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/viperfx/32/3060_2.png) [@viperfx](https://community.forestadmin.com/u/viperfx)\
**Post date:** [September 9, 2021, 6:02pm UTC](https://community.forestadmin.com/t/unable-to-start-the-server/3256/1 "2021-09-09T18:02:39Z")

</div>

This is a template you can use to report issues. You can also drag images, videos and include `Preformatted text`

## Expected behavior

The server should stay

## Actual behavior

After running npm start - I get the following error

```javascript
> usadmin@0.0.1 start /home/tharshan/Projects/uservitals/admin
> node ./server.js

Model creation error: Error: ARRAY is missing type definition for its values.
/home/tharshan/Projects/uservitals/admin/node_modules/sequelize/lib/associations/mixin.js:93
      throw new Error(`${source.name}.${_.lowerFirst(Type.name)} called with something that's not a subclass of Sequelize.Model`);
      ^

Error: changelogEntryToRoadmapItem.belongsTo called with something that's not a subclass of Sequelize.Model

```

## Failure Logs

Please include any relevant log snippets, if necessary.

## Context

Please provide any relevant information about your setup.

- Package Version: latest
- Express Version: latest
- Sequelize Version: latest
- Database Dialect: sql
- Database Version: postgres 13.3

---

<div class="post-metadata">

**Author:** ![Sliman\_Medini](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/sliman_medini/32/19_2.png) [@Sliman\_Medini](https://community.forestadmin.com/u/Sliman_Medini)\
**Post date:** [September 10, 2021, 8:24am UTC](https://community.forestadmin.com/t/unable-to-start-the-server/3256/2 "2021-09-10T08:24:44Z")

</div>

hi @viperfx,

Can you please describe the steps you follow to create your project?

The logged error relates a problem with `changelogEntryToRoadmapItem ` model.  
Can you please share it, with others models that are related to it?

Regards

---

<div class="post-metadata">

**Author:** ![viperfx](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/viperfx/32/3060_2.png) [@viperfx](https://community.forestadmin.com/u/viperfx)\
**Post date:** [September 11, 2021, 5:47am UTC](https://community.forestadmin.com/t/unable-to-start-the-server/3256/3 "2021-09-11T05:47:59Z")

</div>

Steps I took, are essentially what the create a new project guide showed me.

```javascript
npm install -g forest-cli@latest -s
forest login
forest projects:create "uvadmin" --databaseConnectionURL ....

```

The above command ran fine and I got the following output at the end

```javascript
  create app.js
  create docker-compose.yml
  create Dockerfile
  create package.json
  create server.js
√ Creating your project files
√ Hooray, installation success!

```

```javascript
npm install -s
npm start

```

```javascript
After running npm start, I got the following stack trace.

Model creation error: Error: ARRAY is missing type definition for its values.
D:\Projects\uvadmin\node_modules\sequelize\lib\associations\mixin.js:93
      throw new Error(`${source.name}.${_.lowerFirst(Type.name)} called with something that's not a subclass of Sequelize.Model`);
      ^

Error: changelogEntryToRoadmapItem.belongsTo called with something that's not a subclass of Sequelize.Model
    at Function.<anonymous> (D:\Projects\uvadmin\node_modules\sequelize\lib\associations\mixin.js:93:13)
    at Function.ChangelogEntryToRoadmapItem.associate (D:\Projects\uvadmin\models\changelog-entry-to-roadmap-item.js:23:33)
    at D:\Projects\uvadmin\models\index.js:30:19
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (D:\Projects\uvadmin\models\index.js:28:17)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object.<anonymous> (D:\Projects\uvadmin\routes\changelog-email-notification.js:3:40)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at D:\Projects\uvadmin\node_modules\require-all\index.js:56:46
    at Array.forEach (<anonymous>)
    at requireAll (D:\Projects\uvadmin\node_modules\require-all\index.js:34:9)
    at Object.<anonymous> (D:\Projects\uvadmin\app.js:56:1)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object.<anonymous> (D:\Projects\uvadmin\server.js:5:13)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)

```

Here is the changelogEntryToRoadmapItem

```javascript
// This model was generated by Forest CLI. However, you remain in control of your models.
// Learn how here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models
module.exports = (sequelize, DataTypes) => {
  const { Sequelize } = sequelize;
  // This section contains the fields of your model, mapped to your table's columns.
  // Learn more here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models#declaring-a-new-field-in-a-model
  const ChangelogEntryToRoadmapItem = sequelize.define('changelogEntryToRoadmapItem', {
  }, {
    tableName: '_ChangelogEntryToRoadmapItem',
    timestamps: false,
    schema: process.env.DATABASE_SCHEMA,
  });
  ChangelogEntryToRoadmapItem.removeAttribute('id');
  // This section contains the relationships for this model. See: https://docs.forestadmin.com/documentation/v/v6/reference-guide/relationships#adding-relationships.
  ChangelogEntryToRoadmapItem.associate = (models) => {
    ChangelogEntryToRoadmapItem.belongsTo(models.changelogEntry, {
      foreignKey: {
        name: 'aKey',
        field: 'A',
      },
      as: 'a',
    });
    ChangelogEntryToRoadmapItem.belongsTo(models.roadmapItem, {
      foreignKey: {
        name: 'bKey',
        field: 'B',
      },
      as: 'b',
    });
  };

  return ChangelogEntryToRoadmapItem;
};

```

This is changelogEntry

```javascript
// This model was generated by Forest CLI. However, you remain in control of your models.

// Learn how here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models

module.exports = (sequelize, DataTypes) => {

  const { Sequelize } = sequelize;

  // This section contains the fields of your model, mapped to your table's columns.

  // Learn more here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models#declaring-a-new-field-in-a-model

  const ChangelogEntry = sequelize.define('changelogEntry', {

    id: {

      type: DataTypes.STRING,

      primaryKey: true,

      allowNull: false,

    },

    title: {

      type: DataTypes.STRING,

      allowNull: false,

    },

    slug: {

      type: DataTypes.STRING,

      allowNull: false,

    },

    desc: {

      type: DataTypes.STRING,

    },

    status: {

      type: DataTypes.ENUM(

        'DRAFT',

        'PUBLISHED',

        'SCHEDULED',

      ),

      defaultValue: Sequelize.literal('\'DRAFT\'::"ChangelogStatus"'),

      allowNull: false,

    },

    createdAt: {

      type: DataTypes.DATE,

      defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),

    },

    updatedAt: {

      type: DataTypes.DATE,

      defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),

    },

    publishAt: {

      type: DataTypes.DATE,

    },

    type: {

      type: DataTypes.ENUM(

        'FIX',

        'ANNOUCEMENT',

        'IMPROVEMENT',

        'NEW',

      ),

    },

    heroImage: {

      type: DataTypes.STRING,

    },

    number: {

      type: DataTypes.INTEGER,

      defaultValue: 0,

      allowNull: false,

    },

  }, {

    tableName: 'ChangelogEntry',

    schema: process.env.DATABASE_SCHEMA,

  });

  // This section contains the relationships for this model. See: https://docs.forestadmin.com/documentation/v/v6/reference-guide/relationships#adding-relationships.

  ChangelogEntry.associate = (models) => {

    ChangelogEntry.belongsTo(models.user, {

      foreignKey: {

        name: 'createdByIdKey',

        field: 'createdById',

      },

      as: 'createdBy',

    });

    ChangelogEntry.belongsTo(models.membership, {

      foreignKey: {

        name: 'createdByMemberIdKey',

        field: 'createdByMemberId',

      },

      as: 'createdByMember',

    });

    ChangelogEntry.belongsTo(models.team, {

      foreignKey: {

        name: 'teamIdKey',

        field: 'teamId',

      },

      as: 'team',

    });

    ChangelogEntry.belongsToMany(models.roadmapItem, {

      through: 'changelogEntryToRoadmapItem',

      foreignKey: 'A',

      otherKey: 'B',

      as: 'roadmapItemThroughChangelogEntryToRoadmapItems',

    });

    ChangelogEntry.belongsToMany(models.emailPreference, {

      through: 'changelogEmailNotification',

      foreignKey: 'changelogEntryId',

      otherKey: 'prefId',

      as: 'emailPreferenceThroughChangelogEmailNotifications',

    });

    ChangelogEntry.hasMany(models.changelogEntryLabel, {

      foreignKey: {

        name: 'changelogEntryIdKey',

        field: 'changelogEntryId',

      },

      as: 'changelogEntryChangelogEntryLabels',

    });

  };

  return ChangelogEntry;

};

```

There are many other models - but not sure it makes sense to share them all on this public forum. I can DM you the project files - if you let me know how I can share it securely for your internal team only.

Also, is there a workaround for this issue?

For example, Is there a command I can use to specify exactly which models I want imported after the analysis. So that way I can include the most important models and see which ones break.

---

<div class="post-metadata">

**Author:** ![viperfx](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/viperfx/32/3060_2.png) [@viperfx](https://community.forestadmin.com/u/viperfx)\
**Post date:** [September 17, 2021, 5:46am UTC](https://community.forestadmin.com/t/unable-to-start-the-server/3256/4 "2021-09-17T05:46:14Z")

</div>

Hi there - could I get this reviewed please? I’ve not been able to use the software due to this issue.

---

<div class="post-metadata">

**Author:** ![Sliman\_Medini](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/sliman_medini/32/19_2.png) [@Sliman\_Medini](https://community.forestadmin.com/u/Sliman_Medini)\
**Post date:** [September 17, 2021, 8:41am UTC](https://community.forestadmin.com/t/unable-to-start-the-server/3256/5 "2021-09-17T08:41:21Z")

</div>

Hi @viperfx, and sorry for the late answer,

You can exclude some models by following [this doc](https://docs.forestadmin.com/documentation/how-tos/settings/include-exclude-models).

Can you please share the SQL script which creates the tables `ChangelogEntryToRoadmapItem` and `changelogEntry ` ? I will need to reproduce this generation failure.  
Also, can you please specify which specific version you used (‘latest’ is not precise enough as it may change recently)

Bets regards

---

<div class="post-metadata">

**Author:** ![viperfx](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/viperfx/32/3060_2.png) [@viperfx](https://community.forestadmin.com/u/viperfx)\
**Post date:** [September 18, 2021, 5:11pm UTC](https://community.forestadmin.com/t/unable-to-start-the-server/3256/6 "2021-09-18T17:11:20Z")

</div>

Where do I find the SQL script?

And will update the post with the version numbers.

---

<div class="post-metadata">

**Author:** ![Sliman\_Medini](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/sliman_medini/32/19_2.png) [@Sliman\_Medini](https://community.forestadmin.com/u/Sliman_Medini)\
**Post date:** [September 20, 2021, 7:56am UTC](https://community.forestadmin.com/t/unable-to-start-the-server/3256/7 "2021-09-20T07:56:57Z")

</div>

The preferred way would be to use [pg\_dump](https://stackoverflow.com/questions/14486241/how-can-i-export-the-schema-of-a-database-in-postgresql).

**Alternative 1** : Figure you are using Postico as database client, when you selected the table, you can find the DDL / Structure menu which will display you the SQL script.

**Alternative 2** : If you are using datagrip as satabase client, when you are on the table list, right click on the table, then select “SQL Script / generate DDL”.

If you are using another tool, check its documentation.

---

<div class="post-metadata">

**Author:** ![viperfx](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/viperfx/32/3060_2.png) [@viperfx](https://community.forestadmin.com/u/viperfx)\
**Post date:** [September 23, 2021, 11:02pm UTC](https://community.forestadmin.com/t/unable-to-start-the-server/3256/8 "2021-09-23T23:02:07Z")

</div>

OK I have uploaded the SQL scripts to github - [Forrest SQL (github.com)](https://gist.github.com/viperfx/22c399650bf9c191cad51d9b44442589)

---

<div class="post-metadata">

**Author:** ![viperfx](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/viperfx/32/3060_2.png) [@viperfx](https://community.forestadmin.com/u/viperfx)\
**Post date:** [September 23, 2021, 11:05pm UTC](https://community.forestadmin.com/t/unable-to-start-the-server/3256/9 "2021-09-23T23:05:07Z")

</div>

The version I am using is forest-cli/2.3.0 win32-x64 node-v14.17.6

---

<div class="post-metadata">

**Author:** ![viperfx](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/viperfx/32/3060_2.png) [@viperfx](https://community.forestadmin.com/u/viperfx)\
**Post date:** [September 23, 2021, 11:13pm UTC](https://community.forestadmin.com/t/unable-to-start-the-server/3256/10 "2021-09-23T23:13:05Z")

</div>

Also I have tried to use the excludeModels option - but when I run `npm start` I can see from the stack trace it walks through the same files. Therefore the error happens.

It seems I have to go and manually comment out lines for each model file?

Is there a way to specify which models to generate at project creation?

---

<div class="post-metadata">

**Author:** ![Sliman\_Medini](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/sliman_medini/32/19_2.png) [@Sliman\_Medini](https://community.forestadmin.com/u/Sliman_Medini)\
**Post date:** [September 24, 2021, 10:15am UTC](https://community.forestadmin.com/t/unable-to-start-the-server/3256/11 "2021-09-24T10:15:58Z")

</div>

Hi,

Thank you.  
I’ve generated a server using the SQL script you provided and I was not able to reproduce the issue, the generation performs fine.

But to have the script working, I dropped relations to tables that are missing from the script.  
The list of dropped elements are the following:

- \_ChangelogEntryToRoadmapItem reference to RoadmapItem
- ChangelogEntry reference to Membership
- ChangelogEntry reference to Team
- ChangelogEntry reference to User
- ChangelogEntry type field
- ChangelogEntry status field

Since the problem is related to a `changelogEntryToRoadmapItem.belongsTo` it can be on `ChangelogEntry` or `RoadmapItem`. The problem should be on `RoadmapItem` because ChangelogEntry is working on my side. Since I don’t have `RoadmapItem`script I can’t check it.

Is this model well generated on your side?

If you need further investigations, please share the entire SQL.

Regards

---

<div class="post-metadata">

**Author:** ![viperfx](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/viperfx/32/3060_2.png) [@viperfx](https://community.forestadmin.com/u/viperfx)\
**Post date:** [September 24, 2021, 5:15pm UTC](https://community.forestadmin.com/t/unable-to-start-the-server/3256/12 "2021-09-24T17:15:58Z")

</div>

I sent you a private message with the full zip file of the code.

---

<div class="post-metadata">

**Author:** ![anon39848301](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@anon39848301](https://community.forestadmin.com/u/anon39848301)\
**Post date:** [September 27, 2021, 10:24am UTC](https://community.forestadmin.com/t/unable-to-start-the-server/3256/13 "2021-09-27T10:24:31Z")

</div>

Hey @viperfx 👋

Could you also send this to me as DM? @Sliman_Medini is currently off, and I’ll take care of your issue 🙏

---

<div class="post-metadata">

**Author:** ![viperfx](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/viperfx/32/3060_2.png) [@viperfx](https://community.forestadmin.com/u/viperfx)\
**Post date:** [October 18, 2021, 3:28pm UTC](https://community.forestadmin.com/t/unable-to-start-the-server/3256/14 "2021-10-18T15:28:18Z")

</div>

Ive added you to the DM.

---

<div class="post-metadata">

**Author:** ![viperfx](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/viperfx/32/3060_2.png) [@viperfx](https://community.forestadmin.com/u/viperfx)\
**Post date:** [January 11, 2022, 6:18pm UTC](https://community.forestadmin.com/t/unable-to-start-the-server/3256/15 "2022-01-11T18:18:32Z")

</div>

Hey, I wanted to follow up on this.

@anon39848301 you mentioned this in DM:

Looks like your `roadmap-item.js` contains

```javascript
type: DataTypes.ARRAY(DataTypes.null),

```

Which is most likely the source of the issue here

```javascript

Any suggestions on whats wrong here?
```

---

<div class="post-metadata">

**Author:** ![anon39848301](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@anon39848301](https://community.forestadmin.com/u/anon39848301)\
**Post date:** [January 12, 2022, 8:07am UTC](https://community.forestadmin.com/t/unable-to-start-the-server/3256/16 "2022-01-12T08:07:02Z")

</div>

Hey @viperfx

Both the

> [@viperfx](#):
>
> `Error: ARRAY is missing type definition for its values.`

&

```javascript
type: DataTypes.ARRAY(DataTypes.null),

```

leads me to think that your server should start by replacing

`DataTypes.null` by the corresponding datatype of the array items you are saving.

Let me know if that helps
