netbirdio/netbird · error

load config: %w

Error message

load config: %w

What it means

Android Client.DebugBundle builds a support bundle. If the engine was never started the in-memory state snapshot is empty, so it falls back to profilemanager.UpdateOrCreateConfig to read or create the config at platformFiles.ConfigurationFilePath(); any failure there (unreadable path, unwritable directory, malformed existing file) is wrapped as this error.

Source

Thrown at client/android/client.go:302

		SearchDomains: strings.Join(searchDomains, ";"),
	}, nil
}

// DebugBundle generates a debug bundle, uploads it, and returns the upload key.
// It works both with and without a running engine. anonymizeLevel is "default"
// or "strict"; strict also anonymizes internal IP ranges, peer names, and
// WireGuard public keys, and implies anonymize.
func (c *Client) DebugBundle(platformFiles PlatformFiles, anonymize bool, anonymizeLevel string) (string, error) {
	cfg, cacheDir, cc := c.stateSnapshot()

	// If the engine hasn't been started, load config from disk
	if cfg == nil {
		var err error
		cfg, err = profilemanager.UpdateOrCreateConfig(profilemanager.ConfigInput{
			ConfigPath: platformFiles.ConfigurationFilePath(),
		})
		if err != nil {
			return "", fmt.Errorf("load config: %w", err)
		}
		cacheDir = platformFiles.CacheDir()
	}

	deps := debug.GeneratorDependencies{
		InternalConfig: cfg,
		StatusRecorder: c.recorder,
		TempDir:        cacheDir,
		StatePath:      platformFiles.StateFilePath(),
	}

	if cc != nil {
		resp, err := cc.GetLatestSyncResponse()
		if err != nil {
			log.Warnf("get latest sync response: %v", err)
		}
		deps.SyncResponse = resp

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. Call DebugBundle only after a successful connect so the state snapshot exists and no disk load is needed.
  2. Verify the app can read and write platformFiles.ConfigurationFilePath() and its parent directory.
  3. If the existing config is corrupt, remove it so UpdateOrCreateConfig can recreate a default one.
Defensive patterns

Strategy: validation

Validate before calling

// Only offer the debug-bundle action once a config is known to exist
if _, err := os.Stat(platformFiles.ConfigurationFilePath()); err != nil && !connected {
    return errors.New("connect or log in first; no config to load")
}

Try / catch

path, err := client.DebugBundle(files, true, "anonymize")
if err != nil {
    if strings.HasPrefix(err.Error(), "load config:") {
        // engine not started AND config unreadable: check permissions,
        // recreate the config, or debug after a successful connect
    }
    return err
}

Prevention

When it happens

Trigger: Calling DebugBundle before a successful Connect/login on a fresh install; the app lacking storage permission for the config path; a corrupted or partially written config file left by a crash.

Common situations: Bug-report button pressed on first launch pre-login; Android scoped-storage revoking access to the chosen directory; config file truncated by a power loss.

Related errors


AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16). Data as JSON: /api/errors/6ce19398b6cd055b. Report an issue: GitHub.