netbirdio/netbird · error · ErrProfileNotFound
profile not found
Error message
profile not found
What it means
Sentinel error ErrProfileNotFound (client/internal/profilemanager/error.go:6) returned by the profile manager store when an operation references a profile ID that does not exist in the persisted profile store. Profiles are keyed by ID and hold per-account daemon configuration, so any Get/Update/Delete/Switch on an unknown ID fails fast with this sentinel instead of silently creating state.
Source
Thrown at client/internal/profilemanager/error.go:6
package profilemanager
import "errors"
var (
ErrProfileNotFound = errors.New("profile not found")
ErrProfileAlreadyExists = errors.New("profile already exists")
ErrNoActiveProfile = errors.New("no active profile set")
)
View on GitHub (pinned to 93e97f4bf1)
Solutions
- List all profiles (the profile manager enumerate API) and use IDs it returns instead of hard-coded or cached IDs.
- If the profile should exist, re-create it with the intended settings.
- Clear the stale reference (e.g. reset the active-profile pointer) so subsequent operations use a valid ID.
Example fix
// before
err := store.UpdateProfile(staleProfileID, update)
// after
if _, err := store.GetProfile(ctx, staleProfileID); profilemanager.IsProfileNotFound(err) {
// profile vanished; recreate instead of updating
_, err = store.CreateProfile(ctx, desiredSettings)
} Defensive patterns
Strategy: try-catch
Validate before calling
// Verify the profile exists before mutating it.
profiles, err := store.GetAllProfiles(ctx)
if err != nil {
return err
}
if !containsProfile(profiles, wantedID) {
return fmt.Errorf("profile %q missing; recreate it", wantedID)
} Type guard
func IsProfileNotFound(err error) bool {
return errors.Is(err, profilemanager.ErrProfileNotFound)
} Try / catch
err := store.UpdateProfile(ctx, id, upd)
if profilemanager.IsProfileNotFound(err) {
// recreate the profile or refresh the UI's profile list
}
if err != nil {
return fmt.Errorf("update profile: %w", err)
} Prevention
- Always use IDs returned by the profile manager, never cached or hand-written ones.
- After any delete/switch operation, refresh the enumerated profile list in UI state.
- Match sentinels with errors.Is, not string comparison, so wrapping keeps working.
When it happens
Trigger: profilemanager.UpdateProfile/DeleteProfile/SwitchToProfile called with an ID not present in the store; a UI holding a cached profile ID after that profile was deleted from another process (CLI); the store file was reset or restored from a backup without that profile.
Common situations: CLI and desktop UI used concurrently: UI caches an ID, user removes the profile via CLI, next UI write fails. Store migration or a wiped state directory leaves stale references. Tests that hand-construct profile IDs instead of using ones returned by CreateProfile.
Related errors
- failed to resolve active profile %q: %w
- delete state: %w
- management client is not initialised
- watcher closed unexpectedly
- failed to verify signature of artifact keys
AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16).
Data as JSON: /api/errors/e523740406575fce.
Report an issue: GitHub.