diff --git a/core/commands2/name.go b/core/commands2/name.go
index <HASH>..<HASH> 100644
--- a/core/commands2/name.go
+++ b/core/commands2/name.go
@@ -20,6 +20,8 @@ type ResolveOutput struct {
 	Entries []IpnsEntry
 }
 
+var errNotOnline = errors.New("This command must be run in online mode. Try running 'ipfs daemon' first.")
+
 var nameCmd = &cmds.Command{
 	Help: "TODO",
 	Subcommands: map[string]*cmds.Command{
@@ -38,6 +40,11 @@ var publishCmd = &cmds.Command{
 		n := req.Context().Node
 		args := req.Arguments()
 
+		if n.Network == nil {
+			res.SetError(errNotOnline, cmds.ErrNormal)
+			return
+		}
+
 		if n.Identity == nil {
 			res.SetError(errors.New("Identity not loaded!"), cmds.ErrNormal)
 			return
@@ -86,6 +93,11 @@ var resolveCmd = &cmds.Command{
 		n := req.Context().Node
 		var names []string
 
+		if n.Network == nil {
+			res.SetError(errNotOnline, cmds.ErrNormal)
+			return
+		}
+
 		if len(req.Arguments()) == 0 {
 			if n.Identity == nil {
 				res.SetError(errors.New("Identity not loaded!"), cmds.ErrNormal)
core/commands2: Output error when trying to run 'publish' or 'resolve' in offline mode