netbirdio/netbird · error

active profile not found, please run 'netbird profile create

Error message

active profile not found, please run 'netbird profile create' first

What it means

The profile store loaded successfully but GetActiveProfile returned nil: no profile exists or none is marked active. This is the empty-state error for a fresh installation or after all profiles were deleted, and the message directs the user to create one. It is a usage/precondition error, not a system failure.

Source

Thrown at client/cmd/login.go:249

	return nil
}

func getActiveProfile(ctx context.Context, pm *profilemanager.ProfileManager, profileName string, username string) (*profilemanager.Profile, error) {
	// switch profile if provided

	if profileName != "" {
		if err := switchProfileOnDaemon(ctx, pm, profileName, username); err != nil {
			return nil, fmt.Errorf("switch profile: %v", err)
		}
	}

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

	if activeProf == nil {
		return nil, fmt.Errorf("active profile not found, please run 'netbird profile create' first")
	}
	return activeProf, nil
}

func switchProfileOnDaemon(ctx context.Context, pm *profilemanager.ProfileManager, handle string, username string) error {
	resolvedID, err := switchProfile(ctx, handle, username)
	if err != nil {
		return fmt.Errorf("switch profile on daemon: %v", err)
	}

	if err := pm.SwitchProfile(resolvedID); err != nil {
		return fmt.Errorf("switch profile: %v", err)
	}

	conn, err := DialClientGRPCServer(ctx, daemonAddr)
	if err != nil {
		log.Errorf("failed to connect to service CLI interface %v", err)
		return err

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. Run 'netbird profile create' (or any 'netbird login' flow that creates the default profile) and retry
  2. Or pass --profile-name pointing at an existing profile from 'netbird profile list' so a profile gets selected instead of relying on the active pointer
  3. If the store was wiped intentionally, re-register the machine with 'netbird up --setup-key <key>' which recreates the default profile

Example fix

# before
$ netbird login
Error: active profile not found, please run 'netbird profile create' first

# after
$ netbird profile create --name work
$ netbird login
Defensive patterns

Strategy: validation

Validate before calling

// Precondition check: an active profile must exist before login flows
pm := profilemanager.NewProfileManager()
profiles, err := pm.GetProfiles()
if err != nil {
    return err
}
active := false
for _, p := range profiles {
    if p.IsActive {
        active = true
    }
}
if !active && len(profiles) == 0 {
    return fmt.Errorf("no profiles: run 'netbird profile create' first")
}

Type guard

// hasActiveProfile narrows the store state before calling getActiveProfile
func hasActiveProfile(profiles []profilemanager.Profile) bool {
    for _, p := range profiles {
        if p.IsActive {
            return true
        }
    }
    return false
}

Prevention

When it happens

Trigger: First run of 'netbird login'/'netbird up' on a machine with no profile store; the previously active profile was deleted without switching to another; the profile store was reset (config dir wiped).

Common situations: New VM or container provisioned and the automation calls login before creating a profile; User cleaned ~/.netbird to 'reset' the client and then ran a status command; Migrated host where the config dir was not carried over

Related errors


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