Emulator not working and unable to train


I had an installation of botpress set up on a virtual server. Yesterday I got it set up on a live server. Everything with the installation went fine. It says it’s connected to the postgres database, the external URL is configured… but the emulator doesn’t work. It opens to an empty window and the train button does nothing.

After hitting the train button, got the following error in the logs:

Training {“botId”:“hermes”,“language”:“en”} could not finish because of an unexpected error. [Error, The “options.env” property must be of type object or one of undefined, null, or worker_threads.SHARE_ENV. Received type string (’[object Object]’)]
TypeError [ERR_INVALID_ARG_TYPE]: The “options.env” property must be of type object or one of undefined, null, or worker_threads.SHARE_ENV. Received type string (’[object Object]’)
at new Worker (internal/worker.js:141:13)
at ThreadPool.createWorker (/snapshot/nlu/node_modules/@botpress/worker/dist/thread-pool.js)
at ThreadPool._createNewWorker (/snapshot/nlu/node_modules/@botpress/worker/dist/worker-pool/index.js)
at Scheduler._generator (/snapshot/nlu/node_modules/@botpress/worker/dist/worker-pool/index.js)
at Scheduler.getNext (/snapshot/nlu/node_modules/@botpress/worker/dist/worker-pool/scheduler.js)
at ThreadPool.run (/snapshot/nlu/node_modules/@botpress/worker/dist/worker-pool/index.js)
at MLThreadPool.startSvmTraining (/snapshot/nlu/packages/nlu/dist/engine/ml/ml-thread-pool/index.js)
at MultiThreadTrainer.train (/snapshot/nlu/packages/nlu/dist/engine/ml/svm/multi-thread-trainer.js)
at OOSIntentClassifier._trainOOScopeSvm (/snapshot/nlu/packages/nlu/dist/engine/engine/intents/oos-intent-classfier.js)
at OOSIntentClassifier.train (/snapshot/nlu/packages/nlu/dist/engine/engine/intents/oos-intent-classfier.js)
at async TrainIntentClassifiers (/snapshot/nlu/packages/nlu/dist/engine/engine/training-pipeline.js)

Can’t find anything in documentation to resolve this error.

Botpress 12.22.2 was installed. Emulator and training won’t work on imported bots or newly created bots.

Can someone help me resolve???

Hi! I had the same issue once I moved to botpress 12.22.2 on Linux

Here is a temporary solution that worked for me till botpress team fixes the error:

(Note: I had trouble on Ubuntu with yarn as it installed some other package with same name using apt. If needed, get yarn package from npm)

  1. Install Botpress stand alone NLU server in a separate directory from URL:
    GitHub - botpress/nlu: Botpress Standalone NLU server.
    Complete yarn - yarn build
    Don’t yarn start it yet
    If you custom host language server and duckling - modily these settings (in the nlu package installed in node_modules folder).

  2. Then stop running botpress instances, if any

  3. Change to the botpress folders where the bot is
    change to /botpress/data/assets/modules/nlu folder and edit config.schema.json file
    change autostart to false
    endpoint http://localhost:3200
    (Please note this file resets at each start of botpress instance. Since this is a temporary fix, you may choose to address this as per your set up).

  4. Now change to stand alone nu dir (created in step 1)
    and do yarn start.
    This should start the stand alone nlu server. Make sure the duckling and lang server are pointing to the correct url or custom directories applicable in your set up.

  5. Now change to botpress directory with your bots. start ./bp
    pull up your bot in browser
    training should happen and your new model created.
    Emulator should work as expected.

Hope this helps.

Hello Teela,

I installed a fresh VM with Botpress 12.22.2 (Binary) on it.

$ cat /etc/os-release
VERSION="20.04.2 LTS (Focal Fossa)"
PRETTY_NAME="Ubuntu 20.04.2 LTS"
$ ls
bindings  botpress-v12_22_2-linux-x64.zip  bp  data  modules  nlu-v0_1_2-linux-x64  uploads 

I set up a postgre database

$ cat .env

Did you create a .env file in the same folder as the ./bp binary :thinking: ?

I created the Welcome bot example and Added more intent and I click on the train button.

I was able to chat with the bot in the emulator window.

Did I miss some things from your deployment?

Thanks again for your question

Sorry for the late reply, it’s been a busy week! So we are currently running

$ cat /etc/os-release
VERSION=“18.04.5 LTS (Bionic Beaver)”
PRETTY_NAME=“Ubuntu 18.04.5 LTS”
PRIVACY_POLICY_URL=“Data privacy | Ubuntu

When we originally tried to install the newer ubuntu several months ago, the botpress wouldn’t recognize the postgres database. This version was working on the virtual machine set up we had with the older version of botpress.

We do have our .env file in the same directory as the ./bp file.

Ok we updated the ubuntu server but botpress is still giving the same error as above and emulator still not working, bot still not training.

Looks like there’s a LOT more in the logs than there was before. Also getting

Using 10 modules
⦿ analytics
⦿ basic-skills
⦿ builtin
⦿ channel-web
⦿ code-editor
⦿ examples
⦿ extensions
⦿ nlu
⦿ qna
⦿ testing
⊝ bot-improvement (disabled)
⊝ broadcast (disabled)
⊝ channel-messenger (disabled)
⊝ channel-slack (disabled)
⊝ channel-smooch (disabled)
⊝ channel-teams (disabled)
⊝ channel-telegram (disabled)
⊝ channel-twilio (disabled)
⊝ channel-vonage (disabled)
⊝ google-speech (disabled)
⊝ hitl (disabled)
⊝ hitlnext (disabled)
⊝ libraries (disabled)
⊝ misunderstood (disabled)
⊝ ndu (disabled)
⊝ nlu-testing (disabled)
⊝ uipath (disabled)


[pool] Tarn: resource destroyer threw an exception Error: operation timed out for an unknown reason
at /snapshot/build-linux/node_modules/tarn/lib/PendingOperation.js:16:27
at tryCatcher (/home/botadmin/modules/.cache/module__833336560d7f1fc8dbb7b194129128522801a77313ab19e12b185840cbe5839d/node_production_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/home/botadmin/modules/.cache/module__833336560d7f1fc8dbb7b194129128522801a77313ab19e12b185840cbe5839d/node_production_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/home/botadmin/modules/.cache/module__833336560d7f1fc8dbb7b194129128522801a77313ab19e12b185840cbe5839d/node_production_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/home/botadmin/modules/.cache/module__833336560d7f1fc8dbb7b194129128522801a77313ab19e12b185840cbe5839d/node_production_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/home/botadmin/modules/.cache/module__833336560d7f1fc8dbb7b194129128522801a77313ab19e12b185840cbe5839d/node_production_modules/bluebird/js/release/promise.js:725:18)
at _drainQueueStep (/home/botadmin/modules/.cache/module__833336560d7f1fc8dbb7b194129128522801a77313ab19e12b185840cbe5839d/node_production_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/home/botadmin/modules/.cache/module__833336560d7f1fc8dbb7b194129128522801a77313ab19e12b185840cbe5839d/node_production_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/home/botadmin/modules/.cache/module__833336560d7f1fc8dbb7b194129128522801a77313ab19e12b185840cbe5839d/node_production_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/home/botadmin/modules/.cache/module__833336560d7f1fc8dbb7b194129128522801a77313ab19e12b185840cbe5839d/node_production_modules/bluebird/js/release/async.js:15:14)
at processImmediate (internal/timers.js:456:21)
at process.topLevelDomainCallback (domain.js:137:15)


You can create the .env in the same folder as your ./bp like this (More info).

$ pwd
$ touch .env 
$ ls -a  

In the .env you can modify your environment variables. All the value are testing value :stuck_out_tongue:



Does this error happen during the startup or during the training?

Ok, I will try modifying the .env file later today and keep you posted.

The other error shows with launch.

Hey gang, Logged in to help Teela,

  • checked .env was good, and rebooted the entire server
  • in browser I went to admin/workspace/default/bots
  • showed logs
  • went to SSH and pm2 restart bp
  • The restart of botpress showed up in admin/workspace/default/bots logs.
  • No errors showed up in the logs until opened the bot in Studio and clicked the Train button.
    Then I got the same error Training {“botId”:“adora”,“language”:“en”} could not finish because of an unexpected error. [Error, The “options.env” property must be of type object or one of undefined, null, or worker_threads.SHARE_ENV. Received type string (’[object Object]’)]

Not seeing the [pool] Tarn: resource destroyer thing anywhere since cleaning up .env

Where is training-pipeline.js getting the “options.env” property from?

I didn’t found any reference in the botpress codebase for the training-pipeline.js :thinking:. From the stack trace the code should be nlu/dist/engine/engine/training-pipeline.js.

I cannot answer you right now :S


I was looking in the botpress/botpress repo. But the code is in the botpress/nlu repo

I still don’t know where it get the option.env

The config file are pass to the NLU binary at the startup.

Does that mean this error is not coming from the botpress codebase?

It was mentioned a fresh download on a fresh Ubuntu install. Has anybody confirmed the community Linux (v12.23.0) working?

The error is part of the botpress codebase, but not from the main repo. The code is part of the botpress/nlu repo.

For the second paragraph. I will test the community Linux (v12.23.0) on a Ubuntu (20.04) later today :slight_smile: