Bad state: No element error when creating Aqueduct project?

While getting tooling set up for a Dart server side app – it was a surprise to receive an error when creating the first piece of the application with an aqueduct create first_project command. The surprise was that everything in the setup and installation of Dart in Visual Studio Code and the installation of Chocolatey (package manager for windows) and Aqueduct (Dart framework) seemed to have been fine.

The error didn’t give much away “*** Uncaught error Bad state: No element” – so a quick search showed others have same problem recently. After reading the suggestions I did some checking in the environment that the setup was running and found that the solution actually required a couple of steps – done in sequence.

Firstly you need to check the windows environment variables (in my case they were missing when I ran a SET command in a dos prompt)

In the example below remember to replace myusername with the currently logged on user name from your PC


Needs to be set to the correct folder


Browse to that folder to ensure its there and the correct version number


This was recommended by a couple of people who had resolved the issue

The final variable is the PATH variable and it should have both of these paths added to it




Important step – make sure you restart any dos session you have open before completing the next step and use the SET command to check that the changes made above have worked !!!!

Finally in a new dos session run as administrator

Issue the command pub global activate aqueduct and wait for it to complete

then in the folder that you want to create this new project reissue the command

aqueduct create dart_server

to create a new Aqueduct project called dart_server