{"record":{"id":"b663f61389e68daf","repo":"juicedata/juicefs","slug":"bad-response-status-s","errorCode":null,"errorMessage":"bad response status %s","messagePattern":"bad response status (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/object/dragonfly.go","lineNumber":206,"sourceCode":"\t}\n\n\tu.Path = path.Join(\"buckets\", d.bucket)\n\tquery := u.Query()\n\tu.RawQuery = query.Encode()\n\treq, err := http.NewRequestWithContext(ctx, http.MethodPost, u.String(), nil)\n\tif err != nil && !isExists(err) {\n\t\treturn err\n\t}\n\tsetUserAgent(req)\n\n\tresp, err := d.client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode/100 != 2 {\n\t\treturn fmt.Errorf(\"bad response status %s\", resp.Status)\n\t}\n\n\treturn nil\n}\n\n// Head returns the object metadata if it exists.\nfunc (d *dragonfly) Head(ctx context.Context, key string) (Object, error) {\n\t// get get object metadata request.\n\tu, err := url.Parse(d.endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tu.Path = path.Join(\"buckets\", d.bucket, \"objects\", key)\n\tif strings.HasSuffix(key, \"/\") {\n\t\tu.Path += \"/\"\n\t}\n","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/object/dragonfly.go#L188-L224","documentation":"The dragonfly object storage driver's Create uploads an object via HTTP and treats any response whose status code is not 2xx as a failure, returning \"bad response status %s\" with the raw status line (e.g. \"502 Bad Gateway\"). The server accepted the request but refused or failed the upload.","triggerScenarios":"Uploading (Create/PUT) to a Dragonfly endpoint (e.g. http://host:8000/...) that responds with 4xx/5xx — 403 auth, 404 unknown peer/path, 500 server error, 502/504 proxy errors.","commonSituations":"Dragonfly dfdaemon/peer not running or wrong port; proxy/LB returning 502; bucket/path permissions misconfigured; disk full on the dragonfly node; version mismatch causing unsupported API paths.","solutions":["Check the returned status string in the error and inspect dragonfly server/dfdaemon logs for the corresponding request.","Verify the endpoint host:port points to a live dragonfly service (curl the URL manually).","Fix authentication/permission settings if the status is 401/403; check upstream proxies if 502/504.","Retry the upload once server-side issues (5xx) are resolved — the driver surfaces the status but does not retry."],"exampleFix":"// before\n// endpoint misconfigured to wrong port\nurl := \"http://127.0.0.1:65001/objects/key\"\n// after\nurl := \"http://127.0.0.1:8000/objects/key\" // correct dfdaemon port","handlingStrategy":"retry","validationCode":"resp, err := http.Head(dragonflyBaseURL + \"/health\")\nif err != nil || resp.StatusCode/100 != 2 {\n    return fmt.Errorf(\"dragonfly endpoint %s not healthy before upload\", dragonflyBaseURL)\n}","typeGuard":null,"tryCatchPattern":"err := store.Create(ctx, key, data)\nif err != nil && strings.Contains(err.Error(), \"bad response status\") {\n    if strings.Contains(err.Error(), \"50\") { // 5xx: transient, retry with backoff\n        err = retryWithBackoff(func() error { return store.Create(ctx, key, data) })\n    }\n}","preventionTips":["Health-check the dragonfly endpoint before bulk uploads","Only retry on 5xx; 4xx requires config/permission fixes","Monitor dfdaemon/proxy logs to correlate status codes with server-side issues"],"tags":["dragonfly","http","upload","network"],"backgroundTag":"http-error-response","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"}