netbirdio/netbird · error
remove service params: %w
Error message
remove service params: %w
What it means
The reset-params command failed to delete service.json. Not-exist is handled as success; the remaining failure means os.Remove was denied, typically because the containing directory is not writable by the current user, or the file is locked on Windows.
Source
Thrown at client/cmd/service_params.go:229
// Merge saved values underneath explicit ones.
merged := make(map[string]string, len(params.ServiceEnvVars)+len(explicit))
maps.Copy(merged, params.ServiceEnvVars)
maps.Copy(merged, explicit) // explicit wins on conflict
serviceEnvVars = envMapToSlice(merged)
}
var resetParamsCmd = &cobra.Command{
Use: "reset-params",
Short: "Remove saved service install parameters",
Long: "Removes the saved service.json file so the next install uses default parameters.",
RunE: func(cmd *cobra.Command, args []string) error {
path := serviceParamsPath()
if err := os.Remove(path); err != nil {
if os.IsNotExist(err) {
cmd.Println("No saved service parameters found")
return nil
}
return fmt.Errorf("remove service params: %w", err)
}
cmd.Printf("Removed saved service parameters (%s)\n", path)
return nil
},
}
// envMapToSlice converts a map of env vars to a KEY=VALUE slice.
func envMapToSlice(m map[string]string) []string {
s := make([]string, 0, len(m))
for k, v := range m {
s = append(s, k+"="+v)
}
return s
}
View on GitHub (pinned to 93e97f4bf1)
Solutions
- Run elevated: sudo netbird service reset-params
- Verify and fix write permission on the state directory
- Remove manually: sudo rm /var/lib/netbird/service.json
- Close editors/scanners that may hold the file on Windows
Defensive patterns
Strategy: validation
Validate before calling
path := serviceParamsPath()
if _, err := os.Stat(path); os.IsNotExist(err) {
fmt.Println("No saved service parameters found")
return nil
} Try / catch
if err := os.Remove(path); err != nil {
if os.IsNotExist(err) {
return nil
}
if os.IsPermission(err) {
return fmt.Errorf("remove service params: rerun elevated: %w", err)
}
return fmt.Errorf("remove service params: %w", err)
} Prevention
- Run reset-params elevated
- Close editors holding service.json on Windows before reset
When it happens
Trigger: Running netbird service reset-params as an unprivileged user against /var/lib/netbird; an editor or antivirus holding the file open on Windows; immutable attribute set on the file.
Common situations: Cleaning up after a root install from a user shell.
Related errors
- read service params %s: %w
- save service params: %w
- create service config: %w
- parse service params %s: %w
- profile not found
AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16).
Data as JSON: /api/errors/34def8e5ab5a0661.
Report an issue: GitHub.