{"record":{"id":"6014678c54f4058b","repo":"k3s-io/k3s","slug":"no-bootstrap-data-found","errorCode":null,"errorMessage":"no bootstrap data found","messagePattern":"no bootstrap data found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"pkg/cluster/storage.go","lineNumber":135,"sourceCode":"\t\t} else if errors.Is(err, rpctypes.ErrGRPCNotSupportedForLearner) {\n\t\t\tlogrus.Debug(\"Skipping bootstrap data save on learner\")\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\n// bootstrapKeyData lists keys stored in the datastore with the prefix \"/bootstrap\", and\n// will return the first such key. It will return an error if not exactly one key is found.\nfunc bootstrapKeyData(ctx context.Context, storageClient store.ReadCloser) (*mvccpb.KeyValue, error) {\n\tbootstrapList, err := storageClient.List(ctx, \"/bootstrap\", 0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(bootstrapList) == 0 {\n\t\treturn nil, errors.New(\"no bootstrap data found\")\n\t}\n\tif len(bootstrapList) > 1 {\n\t\treturn nil, errors.New(\"found multiple bootstrap keys in storage\")\n\t}\n\treturn &bootstrapList[0], nil\n}\n\n// storageBootstrap loads data from the datastore's bootstrap key into the\n// ControlRuntimeBootstrap struct. The storage key and encryption passphrase are both derived\n// from the join token. If no bootstrap key exists, indicating that data needs to be written\n// back to the datastore, this function will set c.saveBootstrap to true and create an empty\n// bootstrap key as a lock. This function will not return successfully until either the\n// bootstrap key has been locked, or data is read into the struct.\nfunc (c *Cluster) storageBootstrap(ctx context.Context) error {\n\tif c.config.KineTLS {\n\t\tbootstrapCtx, cancel := context.WithCancel(ctx)\n\t\tdefer func() {\n\t\t\ttime.Sleep(time.Second)","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/k3s-io/k3s/blob/6ba341e396edc16b8dcae978a7c5e3ac7ee5606e/pkg/cluster/storage.go#L117-L153","documentation":"bootstrapKeyData lists keys with prefix '/bootstrap' and requires exactly one; zero entries yields this error. It is returned on paths that assume an initialized datastore (the caller expected existing bootstrap data to read or lock), so the datastore has never had bootstrap written or it was removed.","triggerScenarios":"storageBootstrap/getBootstrapKeyFromStorage running against a datastore where no '/bootstrap/*' key exists while the server believes it is joining or reading an existing cluster (token file exists but datastore was wiped); kine endpoint pointing at an empty external database.","commonSituations":"External SQL database recreated/emptied while node credentials (token file, certs) still exist; etcd restored without the bootstrap key; wrong --datastore-endpoint pointing at a fresh database.","solutions":["Verify the datastore endpoint is the one the cluster was created on and is reachable; an accidental empty DB is the most common cause.","If the datastore is genuinely empty, reinitialize: remove stale node state (token file/db dir) and start the first server with --cluster-init.","Restore the external database or etcd from a backup that contains the /bootstrap key."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-start check that the datastore actually contains bootstrap data:\nlist, err := storageClient.List(ctx, \"/bootstrap\", 0)\nif err != nil { return err }\nif len(list) == 0 {\n\treturn errors.New(\"datastore has no /bootstrap keys: wrong endpoint or wiped DB; reinitialize with --cluster-init\")\n}","typeGuard":null,"tryCatchPattern":"if err := c.storageBootstrap(ctx); err != nil {\n\tif strings.Contains(err.Error(), \"no bootstrap data found\") {\n\t\t// verify --datastore-endpoint points at the ORIGINAL database; if truly empty, reinit\n\t}\n\treturn err\n}","preventionTips":["Double-check --datastore-endpoint (DNS, port, database name) before first start against a wiped DB.","Keep node state (token file) and datastore lifecycle in sync: recreating the DB requires reinitializing nodes.","Alert on external-database recreation events so an accidental empty DB is caught early."],"tags":["k3s","bootstrap","datastore","etcd","storage"],"backgroundTag":null,"analyzedSha":"6ba341e396edc16b8dcae978a7c5e3ac7ee5606e","analyzedAt":"2026-08-15T16:27:54.286Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}