title: UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: Cannot read property 'type' of undefined #3090
body: <p>I am creating relations between models in loopback application, but when i execute the following command 
  <code>slc loopback:relation</code> I throws the following error.</p>
  
  <p><strong>Error</strong></p>
  
  <pre><code>(node:6444) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: Cannot read property 'type' of undefined
  
  
  events.js:160
        throw er; // Unhandled 'error' event
        ^
  
  TypeError: Cannot read property 'type' of undefined
      at C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\inquirer\lib\objects\choices.js:16:12
      at Array.map (native)
      at new module.exports (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\inquirer\lib\objects\choices.js:15:26)
      at Prompt.module.exports (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\inquirer\lib\prompts\base.js:43:24)
      at new Prompt (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\inquirer\lib\prompts\list.js:26:8)
      at PromptUI.fetchAnswer (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\inquirer\lib\ui\prompt.js:77:16)
      at tryCatcher (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\rx\dist\rx.js:63:31)
      at InnerObserver.Rx.FlatMapObservable.InnerObserver.next (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\rx\dist\rx.js:2140:43)
      at InnerObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\rx\dist\rx.js:1762:31)
      at InnerObserver.tryCatcher (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\rx\dist\rx.js:63:31)
      at AutoDetachObserverPrototype.next (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\rx\dist\rx.js:5883:51)
      at AutoDetachObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\rx\dist\rx.js:1762:31)
      at InnerObserver.next (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\rx\dist\rx.js:3547:65)
      at InnerObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\rx\dist\rx.js:1762:31)
      at InnerObserver.tryCatcher (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\rx\dist\rx.js:63:31)
      at AutoDetachObserverPrototype.next (C:\Users\DELL5110\AppData\Roaming\npm\node_modules\strongloop\node_modules\rx\dist\rx.js:5883:51)
  </code></pre>
  
  <p><strong><code>slc -v</code></strong></p>
  
  <pre><code>strongloop v6.0.3 (node v6.9.2)
  ├── strong-arc@1.8.9 (3dd25ac)
  ├── strong-build@2.1.2 (a98f310)
  ├── strong-deploy@3.1.4 (9b29df0)
  ├── strong-mesh-models@8.1.0 (62e539b)
  ├── strong-pm@5.2.3
  ├── strong-registry@1.1.6 (f8c2339)
  ├── strong-start@1.3.4 (28c261d)
  ├─┬ strong-supervisor@3.3.3
  │ └── strong-agent@2.1.1 (b51fc45)
  ├── generator-loopback@1.25.0 (6a0e2c0)
  ├── node-inspector@0.7.5 (16841d6)
  └── nodefly-register@0.3.3
  </code></pre>
  
  <p>node : 6.9.2
  npm: 3.10.9</p>
  
  <p><strong>I am Using Mongodb with models</strong></p>
  
  <p>here is my project</p>
  
  <p><a href="https://github.com/rizvanhaider/node-shop" rel="nofollow noreferrer">https://github.com/rizvanhaider/node-shop</a></p>