diff --git a/ipn/local.go b/ipn/local.go index fc994bcd1..c981e66ff 100644 --- a/ipn/local.go +++ b/ipn/local.go @@ -8,6 +8,7 @@ "context" "errors" "fmt" + "os" "strings" "sync" "time" @@ -669,7 +670,9 @@ func (b *LocalBackend) loadStateLocked(key StateKey, prefs *Prefs, legacyPath st if legacyPath != "" { b.prefs, err = LoadPrefs(legacyPath) if err != nil { - b.logf("Failed to load legacy prefs: %v", err) + if !os.IsNotExist(err) { + b.logf("Failed to load legacy prefs: %v", err) + } b.prefs = NewPrefs() } else { b.logf("Imported state from relaynode for %q", key) diff --git a/ipn/prefs.go b/ipn/prefs.go index 50759e1bd..5febba4e9 100644 --- a/ipn/prefs.go +++ b/ipn/prefs.go @@ -228,11 +228,11 @@ func (p *Prefs) Clone() *Prefs { func LoadPrefs(filename string) (*Prefs, error) { data, err := ioutil.ReadFile(filename) if err != nil { - return nil, fmt.Errorf("loading prefs from %q: %v", filename, err) + return nil, fmt.Errorf("LoadPrefs open: %w", err) // err includes path } p, err := PrefsFromBytes(data, false) if err != nil { - return nil, fmt.Errorf("decoding prefs in %q: %v", filename, err) + return nil, fmt.Errorf("LoadPrefs(%q) decode: %w", filename, err) } return p, nil }