{"record":{"id":"f5a7197860434c75","repo":"weaviate/weaviate","slug":"create-replica-staging-dir-w","errorCode":null,"errorMessage":"create replica staging dir: %w","messagePattern":"create replica staging dir: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"adapters/repos/db/replica_snapshot.go","lineNumber":63,"sourceCode":"\tdefer i.replicaSnapshotOpLocks.Unlock(opID)\n\n\tshard, release, err := i.GetShard(ctx, shardName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"incoming create replica snapshot get shard %s: %w\", shardName, err)\n\t}\n\tdefer release()\n\tif shard == nil {\n\t\treturn nil, fmt.Errorf(\"incoming create replica snapshot: shard %q not found\", shardName)\n\t}\n\n\t// On retry the prior snapshot may be stale relative to current shard contents.\n\tif rerr := i.releaseReplicaSnapshot(ctx, opID, shard); rerr != nil {\n\t\treturn nil, fmt.Errorf(\"clean prior replica snapshot for op %q: %w\", opID, rerr)\n\t}\n\n\tstagingRoot := replicaStagingDir(i.Config.RootPath, opID, schema.ClassName(i.Config.ClassName))\n\tif err := os.MkdirAll(stagingRoot, 0o755); err != nil {\n\t\treturn nil, fmt.Errorf(\"create replica staging dir: %w\", err)\n\t}\n\n\tif file.ProbeHardlinkSupport(i.Config.RootPath) {\n\t\tfiles, err := shard.CreateReplicaSnapshot(ctx, stagingRoot)\n\t\tif err != nil {\n\t\t\ti.cleanupFailedReplicaSnapshot(stagingRoot, opID, false, nil)\n\t\t\treturn nil, err\n\t\t}\n\t\ti.logger.WithField(\"op_id\", opID).WithField(\"shard\", shardName).\n\t\t\tDebugf(\"created replica snapshot: %d files\", len(files))\n\t\ti.recordReplicaSnapshot(opID, replicaSnapshotState{shardName: shardName, isSnapshot: true})\n\t\treturn files, nil\n\t}\n\n\t// Halt-for-duration fallback: shard stays halted until Release; segments\n\t// are served from the live shard root in this mode. The inactivity timeout\n\t// backstops a target crash so the halt can't leak forever waiting on a peer that's gone.\n\tif err := shard.HaltForTransfer(ctx, false, i.Config.TransferInactivityTimeout); err != nil {","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/repos/db/replica_snapshot.go#L45-L81","documentation":"Wraps the failure of creating the replica-snapshot staging directory (replicaStagingDir under rootPath) — typically a mkdir/permission/disk-space error — after the shard was successfully obtained and any prior snapshot cleaned.","triggerScenarios":"Thrown at adapters/repos/db/replica_snapshot.go:63 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check disk space and permissions on the configured RootPath.","Inspect the wrapped OS error for the exact mkdir/read failure.","Free space or fix permissions, then retry the replication operation; the failed staging dir is cleaned up automatically."],"exampleFix":null,"handlingStrategy":"fallback","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"}