{"record":{"id":"48d41480a5084297","repo":"juicedata/juicefs","slug":"creating-a-bucket-that-already-exists-returns-an-e","errorCode":null,"errorMessage":"creating a bucket that already exists returns an error","messagePattern":"creating a bucket that already exists returns an error","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/objbench.go","lineNumber":772,"sourceCode":"\t\t\tdefer blob.Delete(ctx, key) //nolint:errcheck\n\t\t\treturn warning(fn())\n\t\t})\n\t}\n\n\trunCase(\"create a bucket\", func(blob object.ObjectStorage) error {\n\t\tcreated := true\n\t\tif err := blob.Put(ctx, key, bytes.NewReader([]byte(\"1\"))); err != nil {\n\t\t\tcreated = false\n\t\t}\n\t\tdefer blob.Delete(ctx, key) //nolint:errcheck\n\n\t\tif !created {\n\t\t\tif err := blob.Create(ctx); err != nil {\n\t\t\t\treturn fmt.Errorf(\"can't create bucket: %s\", err)\n\t\t\t}\n\t\t}\n\t\tif err := blob.Create(ctx); err != nil {\n\t\t\treturn fmt.Errorf(\"creating a bucket that already exists returns an error\")\n\t\t}\n\t\treturn nil\n\t})\n\n\trunCase(\"put an object\", func(blob object.ObjectStorage) error {\n\t\tbr := []byte(\"hello\")\n\t\tif err := blob.Put(ctx, key, bytes.NewReader(br)); err != nil {\n\t\t\treturn fmt.Errorf(\"put object failed: %s\", err)\n\t\t}\n\t\tdefer blob.Delete(ctx, key) //nolint:errcheck\n\t\treturn nil\n\t})\n\n\trunCase(\"get an object\", func(blob object.ObjectStorage) error {\n\t\tbr := []byte(\"hello\")\n\t\tif err := blob.Put(ctx, key, bytes.NewReader(br)); err != nil {\n\t\t\treturn fmt.Errorf(\"put object failed: %s\", err)\n\t\t}","sourceCodeStart":754,"sourceCodeEnd":790,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/cmd/objbench.go#L754-L790","documentation":"Returned by objbench's 'create a bucket' test when calling Create on an already-existing bucket does not return an error. The benchmark expects POSIX-style EEXIST semantics, so a backend that silently tolerates re-creation fails this compatibility check.","triggerScenarios":"Thrown at cmd/objbench.go:772 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Treat this as a backend behavior difference; note it in benchmark comparisons","Use a fresh/non-existent bucket name for each run if strict semantics are required"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}