                     opts.args.shift()
                 state_info = STATES[state]
                 if not state_info?
-                    err = "bug / internal error -- unknown state '#{misc.to_json(state)}'"
+                    err = "bug / internal error -- unknown state '#{misc.to_safe_str(state)}'"
                     dbg(err)
                     opts.after_command_cb?(err)
                     cb(err)

                            socket.on 'mesg', (type, mesg) =>
                                if type == 'json'
                                    if mesg.event == 'project_state_update'
                                        winston.debug("state_update #{misc.to_json(mesg)}")
                                        p = @_project_cache[mesg.project_id]
                                        if p? and p.host == opts.host  # ignore updates from wrong host
                                            p._state      = mesg.state

        bash    : false
        path    : process.cwd()
        cb      : (err, output) =>
            #winston.debug(misc.to_safe_str(output))
            winston.debug("smc_compute: finished running #{misc.to_safe_str(opts.args)} -- #{err}")
            if err
                if output?.stderr
                    opts.cb(output.stderr)
