{"record":{"id":"b6b458658535f712","repo":"weaviate/weaviate","slug":"verify-leader-before-export-w","errorCode":null,"errorMessage":"verify leader before export: %w","messagePattern":"verify leader before export: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cluster/store_query.go","lineNumber":126,"sourceCode":"\t\t\treturn &cmd.QueryResponse{}, fmt.Errorf(\"could not get dynamic user: %w\", err)\n\t\t}\n\tcase cmd.QueryRequest_TYPE_USER_IDENTIFIER_EXISTS:\n\t\tpayload, err = st.dynUserManager.CheckUserIdentifierExists(req)\n\t\tif err != nil {\n\t\t\treturn &cmd.QueryResponse{}, fmt.Errorf(\"could not check user identifier: %w\", err)\n\t\t}\n\tcase cmd.QueryRequest_TYPE_EXPORT_USERS:\n\t\t// Barrier proves this node is still leader and has applied every committed\n\t\t// entry, so a fresh leader cannot return a short roster. Per-id reads skip\n\t\t// it; the apply re-checks them. raft is nil only in unit-test stores.\n\t\tif st.raft != nil {\n\t\t\tvar sub cmd.QueryExportUsersRequest\n\t\t\tif err := json.Unmarshal(req.SubCommand, &sub); err != nil {\n\t\t\t\treturn &cmd.QueryResponse{}, fmt.Errorf(\"could not export dynamic users: %w\", err)\n\t\t\t}\n\t\t\tif len(sub.UserIds) == 0 {\n\t\t\t\tif err := st.raft.Barrier(st.cfg.ConsistencyWaitTimeout).Error(); err != nil {\n\t\t\t\t\treturn &cmd.QueryResponse{}, fmt.Errorf(\"verify leader before export: %w\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tpayload, err = st.dynUserManager.ExportUsers(req)\n\t\tif err != nil {\n\t\t\treturn &cmd.QueryResponse{}, fmt.Errorf(\"could not export dynamic users: %w\", err)\n\t\t}\n\tcase cmd.QueryRequest_TYPE_GET_NAMESPACES:\n\t\tpayload, err = st.namespaceManager.Get(req)\n\t\tif err != nil {\n\t\t\treturn &cmd.QueryResponse{}, fmt.Errorf(\"could not get namespaces: %w\", err)\n\t\t}\n\tcase cmd.QueryRequest_TYPE_GET_REPLICATION_DETAILS:\n\t\tpayload, err = st.replicationManager.GetReplicationDetailsByReplicationId(req)\n\t\tif err != nil {\n\t\t\treturn &cmd.QueryResponse{}, fmt.Errorf(\"could not get replication operation details: %w\", err)\n\t\t}\n\tcase cmd.QueryRequest_TYPE_GET_REPLICATION_DETAILS_BY_COLLECTION:","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/cluster/store_query.go#L108-L144","documentation":"Before a full-roster user export, the store issues a RAFT Barrier to prove leadership and full log application; if the Barrier fails or times out (ConsistencyWaitTimeout), the export is refused rather than returning a possibly stale roster.","triggerScenarios":"Thrown at cluster/store_query.go:126 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the full-roster export — a fresh barrier usually succeeds once leadership settles","Check raft leadership status; query the current leader instead of a deposed node","Increase ConsistencyWaitTimeout if barriers routinely time out on large clusters"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}