juicedata/juicefs · error
put `/` suffixed object failed: %s
Error message
put `/` suffixed object failed: %s
What it means
objbench tests that the backend can store an object whose key ends with '/' ('slash_test_file/'), wrapping Put failures with this message. Some stores treat trailing-slash keys specially (as 'directories') and reject them.
Source
Thrown at cmd/objbench.go:1018
}
if err := blob.Put(ctx, key, bytes.NewReader(content)); err != nil {
return err
}
defer blob.Delete(ctx, key) //nolint:errcheck
return nil
})
runCase("put an empty object", func(blob object.ObjectStorage) error {
// Copy empty objects
defer blob.Delete(ctx, "empty_test_file") //nolint:errcheck
if err := blob.Put(ctx, "empty_test_file", bytes.NewReader([]byte{})); err != nil {
return err
}
// Copy `/` suffixed object
defer blob.Delete(ctx, "slash_test_file/") //nolint:errcheck
if err := blob.Put(ctx, "slash_test_file/", bytes.NewReader([]byte("1"))); err != nil {
return fmt.Errorf("put `/` suffixed object failed: %s", err)
}
return nil
})
runCase("multipart upload", func(blob object.ObjectStorage) (err error) {
defer func() {
err = warning(err)
}()
key := "multi_test_file"
if err = blob.CompleteUpload(ctx, key, "notExistsUploadId", []*object.Part{}); err != utils.ErrNotSUP {
defer blob.Delete(ctx, key) //nolint:errcheck
upload, err := blob.CreateMultipartUpload(ctx, key)
if err != nil {
return fmt.Errorf("create multipart upload failed: %s", err)
}
total := 3
seed := make([]byte, upload.MinPartSize)View on GitHub (pinned to c9a67b23e8)
Solutions
- Read the wrapped backend error for the root cause
- Check the driver doesn't strip or transform the trailing slash in keys
- Verify the backend permits keys ending in '/'
- If unsupported, accept it as a backend limitation
Defensive patterns
Strategy: try-catch
Validate before calling
// probe trailing-slash key support
if err := blob.Put(ctx, "probe/", bytes.NewReader(nil)); err != nil { /* backend rejects '/'-suffixed keys */ }
_ = blob.Delete(ctx, "probe/") Try / catch
if err := blob.Put(ctx, "slash_test_file/", r); err != nil {
// fall back or report backend limitation
return fmt.Errorf("put `/` suffixed object failed: %s", err)
} Prevention
- Confirm the backend allows keys ending in '/'
- Ensure the driver does not strip or normalize trailing slashes
- Accept as a known limitation on restrictive backends
When it happens
Trigger: `blob.Put(ctx, "slash_test_file/", ...)` returns an error during the slash-key test case.
Common situations: Backends that forbid zero-byte or trailing-slash keys; drivers that normalize/strip the trailing slash before sending; S3-compatible stores with path-mode restrictions.
Understand the failure class
Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.
Related errors
- put encode file failed: %s
- ceph: can't put empty file
- GOOGLE_CLOUD_PROJECT environment variable must be set
- object key cannot be empty
- not exists
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/325fadf46d4ca8e3.
Report an issue: GitHub.