netbirdio/netbird · error

get active profile: %v

Error message

get active profile: %v

What it means

debugConfigDump starts by reading the active profile from the local profile manager (profilemanager.NewProfileManager().GetActiveProfile()) and wraps its failure here. The profile store holds the per-account config files the CLI/daemon share; GetActiveProfile fails when no profile has ever been created (the machine is not logged in / netbird up never ran) or when the store files cannot be read or parsed.

Source

Thrown at client/cmd/debug.go:115

}

// debugConfigDump implements `netbird debug config`. It resolves the
// active profile, queries the daemon for the effective configuration
// via GetConfig, and prints the resulting GetConfigResponse as JSON
// (via protojson with EmitUnpopulated=true so the output is stable
// across runs and includes zero-valued fields).
//
// Useful for verifying MDM enforcement end-to-end: the response's
// mDMManagedFields array is the single source of truth for "which
// fields is the daemon currently enforcing from the MDM source", and
// every config field side-by-side with that list confirms the merge
// result. Secrets in the response (e.g. PreSharedKey) are already
// redacted by the daemon-side handler.
func debugConfigDump(cmd *cobra.Command, _ []string) error {
	pm := profilemanager.NewProfileManager()
	activeProf, err := pm.GetActiveProfile()
	if err != nil {
		return fmt.Errorf("get active profile: %v", err)
	}
	currUser, err := user.Current()
	if err != nil {
		return fmt.Errorf("get current user: %v", err)
	}

	conn, err := getClient(cmd)
	if err != nil {
		return err
	}
	defer func() {
		if err := conn.Close(); err != nil {
			log.Errorf(errCloseConnection, err)
		}
	}()

	client := proto.NewDaemonServiceClient(conn)
	resp, err := client.GetConfig(cmd.Context(), &proto.GetConfigRequest{

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. Confirm the machine is logged in: netbird status should show a connected peer; if not, run netbird up first and retry the dump
  2. Check the config directory exists and is readable (default ~/.config/netbird, or NB_CONFIG_DIR if set); fix ownership if it was created by root/sudo previously
  3. If the store is corrupted, the direct fix is to re-run netbird login (recreating the profile) — the dump cannot work without a valid active profile
  4. Ensure you run the dump as the same OS user that owns the profile (no interleaved sudo)

Example fix

# before: dumping before the machine ever connected
netbird debug config-dump
# -> get active profile: ...

# after: connect once, then dump
netbird up && netbird debug config-dump
Defensive patterns

Strategy: validation

Validate before calling

// Ensure a profile exists before dumping:
pm := profilemanager.NewProfileManager()
profiles, _ := pm.GetProfiles()
if len(profiles) == 0 {
    return fmt.Errorf("no profile found; run 'netbird up' first")
}
if _, err := pm.GetActiveProfile(); err != nil {
    return fmt.Errorf("get active profile: %v", err)
}

Prevention

When it happens

Trigger: Running netbird debug config-dump on a machine before the first netbird up/login; the active-profile pointer file is corrupted or empty after a partial write; config directory permissions deny read; NB_CONFIG_DIR/custom env pointing at a non-store directory.

Common situations: CI or a fresh VM where the CLI was installed but never connected; a second user account on a shared machine without its own profile; moving/deleting the config dir (~/.config/netbird) while the daemon runs; HOME unset so the store resolves to an unexpected path.

Related errors


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