netbirdio/netbird · error

get active profile: %v

Error message

get active profile: %v

What it means

Thrown by upFunc (client/cmd/up.go:141) when pm.GetActiveProfile() fails to load the active profile from the local profile manager store. The CLI needs the active profile to know which config file to use. It fails when no active profile is set (fresh or migrated store) or when the store cannot be read (permissions, corruption).

Source

Thrown at client/cmd/up.go:141

	pm := profilemanager.NewProfileManager()

	username, err := user.Current()
	if err != nil {
		return fmt.Errorf("get current user: %v", err)
	}

	var profileSwitched bool
	// switch profile if provided
	if profileName != "" {
		if err := switchOrCreateProfile(cmd.Context(), pm, profileName, username.Username); err != nil {
			return fmt.Errorf("switch profile: %v", err)
		}
		profileSwitched = true
	}

	activeProf, err := pm.GetActiveProfile()
	if err != nil {
		return fmt.Errorf("get active profile: %v", err)
	}

	if foregroundMode {
		return runInForegroundMode(ctx, cmd, activeProf)
	}
	return runInDaemonMode(ctx, cmd, pm, activeProf, profileSwitched)
}

// switchOrCreateProfile switches the active profile to the one identified by
// handle, creating it first when it does not exist yet. This restores the
// pre-0.73 behaviour where `netbird up --profile <name>` auto-creates a
// missing profile instead of failing.
func switchOrCreateProfile(ctx context.Context, pm *profilemanager.ProfileManager, handle, username string) error {
	resolvedID, err := switchProfile(ctx, handle, username)
	if err != nil {
		st, ok := gstatus.FromError(err)
		if !ok || st.Code() != codes.NotFound {
			return err

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. Run 'netbird profiles list' to inspect the store and see whether any profile is marked active
  2. Switch to an existing profile or let up create one: 'netbird up --profile <name>'
  3. Fix ownership of the netbird config directory (chown -R $USER) if sudo/non-sudo mixing corrupted it
  4. As a last resort, back up and remove the profile store so it is recreated cleanly
Defensive patterns

Strategy: fallback

Validate before calling

if _, err := pm.GetActiveProfile(); err != nil {
    // fresh store: create/select a profile explicitly instead of relying on default
    log.Warn("no active profile - run netbird up --profile <name> to bootstrap")
}

Prevention

When it happens

Trigger: Running 'netbird up' on a fresh install before any profile exists; a profile store JSON that is unreadable or hand-corrupted; the store directory owned by root after mixing sudo and non-sudo invocations; a partially completed 0.73-era profile migration.

Common situations: First run after install; deleted or moved ~/.config/netbird; running the CLI as a different user than the one who set up profiles.

Related errors


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