{"record":{"id":"c8c1597e3c1e86c2","repo":"k3s-io/k3s","slug":"managed-etcd-cluster-membership-was-previously-res","errorCode":null,"errorMessage":"Managed etcd cluster membership was previously reset, please remove the cluster-reset flag and start %s normally. If you need to perform another cluster reset, you must first manually delete the file at %s","messagePattern":"Managed etcd cluster membership was previously reset, please remove the cluster-reset flag and start (.+?) normally\\. If you need to perform another cluster reset, you must first manually delete the file at (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cluster/managed.go","lineNumber":54,"sourceCode":"\n\tresetDone, err := c.managedDB.IsReset()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif c.config.ClusterReset {\n\t\t// If we're restoring from a snapshot, don't check the reset-flag - just reset and restore.\n\t\tif c.config.ClusterResetRestorePath != \"\" {\n\t\t\treturn c.managedDB.Reset(ctx, wg, rebootstrap)\n\t\t}\n\n\t\t// If the reset-flag doesn't exist, reset. This will create the reset-flag if it succeeds.\n\t\tif !resetDone {\n\t\t\treturn c.managedDB.Reset(ctx, wg, rebootstrap)\n\t\t}\n\n\t\t// The reset-flag exists, ask the user to remove it if they want to reset again.\n\t\treturn fmt.Errorf(\"Managed etcd cluster membership was previously reset, please remove the cluster-reset flag and start %s normally. \"+\n\t\t\t\"If you need to perform another cluster reset, you must first manually delete the file at %s\", version.Program, c.managedDB.ResetFile())\n\t}\n\n\tif resetDone {\n\t\t// If the cluster was reset, we need to delete the node passwd secret in case the node\n\t\t// password from the previously restored snapshot differs from the current password on disk.\n\t\tc.config.Runtime.ClusterControllerStarts[\"node-password-secret-cleanup\"] = c.deleteNodePasswdSecret\n\t}\n\n\t// Starting the managed database will clear the reset-flag if set\n\treturn c.managedDB.Start(ctx, wg, c.clientAccessInfo)\n}\n\n// registerDBHandlers registers managed-datastore-specific callbacks, and installs additional HTTP route handlers.\n// Note that for etcd, controllers only run on nodes with a local apiserver, in order to provide stable external\n// management of etcd cluster membership without being disrupted when a member is removed from the cluster.\nfunc (c *Cluster) registerDBHandlers(handler http.Handler) (http.Handler, error) {\n\tif c.managedDB == nil {","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/k3s-io/k3s/blob/6ba341e396edc16b8dcae978a7c5e3ac7ee5606e/pkg/cluster/managed.go#L36-L72","documentation":"k3s guards against accidental repeated resets of the managed (embedded etcd) datastore. A successful `--cluster-reset` writes a reset-flag file (managedDB.ResetFile(), default /var/lib/rancher/k3s/server/db/reset-flag). On the next startup with `--cluster-reset` still set and no `--cluster-reset-restore-path`, startup aborts with this error instead of wiping etcd membership again.","triggerScenarios":"Starting k3s server a second consecutive time with config.ClusterReset=true while the reset-flag file exists and ClusterResetRestorePath is empty (pkg/cluster/managed.go:47-55).","commonSituations":"Operator leaves `--cluster-reset` in the systemd unit or config file after the first reset; automation that passes --cluster-reset on every start; re-running reset to 'fix' something without deleting the flag file.","solutions":["Remove `--cluster-reset` from the CLI flags / config file and start k3s normally - the previous reset already took effect.","If another reset is truly needed, delete the reset-flag file at the path printed in the error (default /var/lib/rancher/k3s/server/db/reset-flag), then start with --cluster-reset again.","If the intent was to restore from a snapshot, pass --cluster-reset-restore-path=<snapshot> - the restore path bypasses the reset-flag check entirely."],"exampleFix":"# before\nExecStart=/usr/local/bin/k3s server --cluster-init --cluster-reset\n\n# after\nExecStart=/usr/local/bin/k3s server --cluster-init\n# (only if another reset is required: rm /var/lib/rancher/k3s/server/db/reset-flag first)","handlingStrategy":"validation","validationCode":"// Before starting k3s with --cluster-reset, check the reset-flag file:\nresetFlag := filepath.Join(dataDir, \"server\", \"db\", \"reset-flag\") // default /var/lib/rancher/k3s/server/db/reset-flag\nif _, err := os.Stat(resetFlag); err == nil {\n    fmt.Printf(\"cluster was already reset; remove %s before resetting again, or drop --cluster-reset\\n\", resetFlag)\n    os.Exit(1)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never leave --cluster-reset in systemd units or config files; pass it once on the command line.","Automate resets with an explicit 'rm -f <data-dir>/server/db/reset-flag' guard before the reset command.","Treat a repeated reset as destructive: prefer --cluster-reset-restore-path from a snapshot."],"tags":["etcd","k3s","cluster-reset","startup","operations"],"backgroundTag":null,"analyzedSha":"6ba341e396edc16b8dcae978a7c5e3ac7ee5606e","analyzedAt":"2026-08-15T16:27:54.286Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}