e2option.flag("no-sync", "do not synchronize with the server")
 
 local opts = e2option.parse(arg)
+-- get build mode from the command line
+local build_mode = policy.handle_commandline_options(opts, true)
+if not build_mode then
+       e2lib.abort("no build mode given")
+end
 local info, re = e2tool.collect_project_info()
 if not info then
   e2lib.abort(re)
   e2lib.abort(re)
 end
 
--- get build mode from the command line
-local build_mode = policy.handle_commandline_options(opts, true)
-if not build_mode then
-       e2lib.abort("no build mode given")
-end
 -- apply the standard build mode to all results
 for _,res in pairs(info.results) do
        res.build_mode = build_mode
 
 e2option.flag("buildid", "display buildids and exit")
 
 local opts = e2option.parse(arg)
+
+-- get build mode from the command line
+local build_mode = policy.handle_commandline_options(opts, true)
+if not build_mode then
+       e2lib.abort("no build mode given")
+end
+
 local info, re = e2tool.collect_project_info()
 if not info then
   e2lib.abort(re)
 
 e2lib.log_invocation(info, arg)
 
--- get build mode from the command line
-local build_mode = policy.handle_commandline_options(opts, true)
-if not build_mode then
-       e2lib.abort("no build mode given")
-end
 -- apply the standard build mode to all results
 for _,res in pairs(info.results) do
        res.build_mode = build_mode
 
 e2option.flag("showpath", "prints the path of the build directory inside the chroot to stdout" )
 
 local opts = e2option.parse(arg)
+-- get build mode from the command line
+local build_mode = policy.handle_commandline_options(opts, true)
+if not build_mode then
+       e2lib.abort("no build mode given")
+end
 local info, re = e2tool.collect_project_info()
 if not info then
   e2lib.abort(re)
 
 r = opts.arguments[1]
 
--- get build mode from the command line
-local build_mode = policy.handle_commandline_options(opts, true)
-if not build_mode then
-       e2lib.abort("no build mode given")
-end
 -- apply the standard build mode to all results
 for _,res in pairs(info.results) do
        res.build_mode = build_mode