{"record":{"id":"48ec14fb8f2ad2c3","repo":"weaviate/weaviate","slug":"prepare-export-w","errorCode":null,"errorMessage":"prepare export: %w","messagePattern":"prepare export: %w","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"adapters/handlers/rest/clusterapi/exports.go","lineNumber":101,"sourceCode":"\t\t\thttp.Error(w, fmt.Errorf(\"read request body: %w\", err).Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tvar req export.ExportRequest\n\t\tif err := json.Unmarshal(body, &req); err != nil {\n\t\t\thttp.Error(w, fmt.Errorf(\"unmarshal request: %w\", err).Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tif err := e.participant.Prepare(r.Context(), &req); err != nil {\n\t\t\tstatus := http.StatusInternalServerError\n\t\t\tswitch {\n\t\t\tcase errors.Is(err, export.ErrExportAlreadyActive):\n\t\t\t\tstatus = http.StatusConflict\n\t\t\tcase errors.Is(err, export.ErrExportValidation):\n\t\t\t\tstatus = http.StatusBadRequest\n\t\t\t}\n\t\t\thttp.Error(w, fmt.Errorf(\"prepare export: %w\", err).Error(), status)\n\t\t\treturn\n\t\t}\n\n\t\tw.WriteHeader(http.StatusOK)\n\t}\n}\n\nfunc (e *exports) commitHandler() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tdefer r.Body.Close()\n\n\t\texportID := r.URL.Query().Get(\"id\")\n\t\tif exportID == \"\" {\n\t\t\thttp.Error(w, \"missing 'id' query parameter\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tif err := e.participant.Commit(r.Context(), exportID); err != nil {","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/handlers/rest/clusterapi/exports.go#L83-L119","documentation":"This is the wrapper error returned by the cluster-internal HTTP endpoint that prepares (starts) a streaming export on a participating node. The handler calls the export participant, and if starting fails it writes the wrapped error to the HTTP response with a status code chosen by error identity: 409 if the error is export.ErrExportAlreadyActive, 400 if it is export.ErrExportValidation, otherwise the default 500. It exists so the coordinating node receives a descriptive reason why a node refused to prepare an export.","triggerScenarios":"POST to the clusterapi export-prepare endpoint when the node cannot start the export: another export is already active on the node (409), the export request fails validation such as invalid output path or class settings (400), or any other participant-level error such as filesystem issues (500).","commonSituations":"Two exports triggered concurrently against the same shard/node; an operator pointing the export at an unwritable or nonexistent output directory; a schema/class mismatch after a collection was renamed or deleted between coordination and preparation.","solutions":["If you got 409, wait for or cancel the currently active export on that node before starting a new one.","If you got 400, check the export request payload: output location, class/shard names, and other validated fields.","Check the node's logs and filesystem permissions for the export output path for non-409/400 failures.","Retry the prepare call after resolving the underlying cause; the error is returned per-node so identify the failing node from the response."],"exampleFix":"// caller checks status before retrying\nif resp.StatusCode == http.StatusConflict {\n    // an export is already active; cancel or wait, then re-prepare\n}","handlingStrategy":"try-catch","validationCode":"// before calling prepare, ensure no export is active and the payload validates\nactive, _ := exportClient.IsActive(node)\nif active {\n    return fmt.Errorf(\"export already active on node\")\n}","typeGuard":null,"tryCatchPattern":"resp, err := client.Post(prepareURL)\nif err != nil { return err }\nswitch resp.StatusCode {\ncase http.StatusConflict:\n    // wait for or cancel the active export, then retry\ncase http.StatusBadRequest:\n    // fix the export request payload\ndefault:\n    // inspect response body (\"prepare export: ...\") and node logs\n}","preventionTips":["Serialize export operations per node rather than triggering them concurrently.","Validate output paths and class settings before dispatching the prepare request.","Track export state so stale exports are committed or cancelled promptly."],"tags":["http","export","cluster","distributed"],"backgroundTag":"export-already-active","analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}