{"record":{"id":"34def8e5ab5a0661","repo":"netbirdio/netbird","slug":"remove-service-params-w","errorCode":null,"errorMessage":"remove service params: %w","messagePattern":"remove service params: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/cmd/service_params.go","lineNumber":229,"sourceCode":"\t// Merge saved values underneath explicit ones.\n\tmerged := make(map[string]string, len(params.ServiceEnvVars)+len(explicit))\n\tmaps.Copy(merged, params.ServiceEnvVars)\n\tmaps.Copy(merged, explicit) // explicit wins on conflict\n\tserviceEnvVars = envMapToSlice(merged)\n}\n\nvar resetParamsCmd = &cobra.Command{\n\tUse:   \"reset-params\",\n\tShort: \"Remove saved service install parameters\",\n\tLong:  \"Removes the saved service.json file so the next install uses default parameters.\",\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\tpath := serviceParamsPath()\n\t\tif err := os.Remove(path); err != nil {\n\t\t\tif os.IsNotExist(err) {\n\t\t\t\tcmd.Println(\"No saved service parameters found\")\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"remove service params: %w\", err)\n\t\t}\n\t\tcmd.Printf(\"Removed saved service parameters (%s)\\n\", path)\n\t\treturn nil\n\t},\n}\n\n// envMapToSlice converts a map of env vars to a KEY=VALUE slice.\nfunc envMapToSlice(m map[string]string) []string {\n\ts := make([]string, 0, len(m))\n\tfor k, v := range m {\n\t\ts = append(s, k+\"=\"+v)\n\t}\n\treturn s\n}\n","sourceCodeStart":211,"sourceCodeEnd":244,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/cmd/service_params.go#L211-L244","documentation":"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.","triggerScenarios":"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.","commonSituations":"Cleaning up after a root install from a user shell.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"path := serviceParamsPath()\nif _, err := os.Stat(path); os.IsNotExist(err) {\n\tfmt.Println(\"No saved service parameters found\")\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":"if err := os.Remove(path); err != nil {\n\tif os.IsNotExist(err) {\n\t\treturn nil\n\t}\n\tif os.IsPermission(err) {\n\t\treturn fmt.Errorf(\"remove service params: rerun elevated: %w\", err)\n\t}\n\treturn fmt.Errorf(\"remove service params: %w\", err)\n}","preventionTips":["Run reset-params elevated","Close editors holding service.json on Windows before reset"],"tags":["service","state","file-permissions","cli","go"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}