{"record":{"id":"612c3c4de6c7a31e","repo":"juicedata/juicefs","slug":"http-status-s","errorCode":null,"errorMessage":"http status: %s","messagePattern":"http status: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/sync/sync.go","lineNumber":139,"sourceCode":"\t\t\t} else {\n\t\t\t\tlogger.Warnf(\"traffic control %s is unavailable, run without rate limit\", l.address)\n\t\t\t}\n\t\t}\n\t}()\n\tr := req{Bytes: ask}\n\tdata, err := json.Marshal(r)\n\tif err != nil {\n\t\treturn 0, 0, err\n\t}\n\tresult, err := http.Post(l.address, \"application/json\", bytes.NewReader(data))\n\tif err != nil || result.StatusCode != http.StatusOK {\n\t\tvar status string\n\t\tif result != nil {\n\t\t\tstatus = http.StatusText(result.StatusCode)\n\t\t}\n\t\tlogger.Warnf(\"request traffic control %s failed: %s, http status: %s\", l.address, err, status)\n\t\tif err == nil {\n\t\t\terr = fmt.Errorf(\"http status: %s\", status)\n\t\t}\n\t\treturn 0, 0, err\n\t}\n\tdefer result.Body.Close()\n\tcontent, err := io.ReadAll(result.Body)\n\tif err != nil {\n\t\treturn 0, 0, err\n\t}\n\tres := resp{}\n\tif err = json.Unmarshal(content, &res); err != nil {\n\t\treturn 0, 0, err\n\t}\n\treturn res.Granted, res.Expired, nil\n}\n\nfunc (l *globalLimit) wait(bytes int64) bool {\n\tl.Lock()\n\tdefer l.Unlock()","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/sync/sync.go#L121-L157","documentation":"JuiceFS cluster sync supports a global traffic-control (rate limit) service addressed by a URL. globalLimit.request POSTs byte-budget requests to it; if the HTTP response status is not 200 (and no transport error occurred), it throws 'http status: <text>'. The limiter is then marked unhealthy and sync falls back to local bwlimit or unlimited.","triggerScenarios":"The traffic-control endpoint responds with a non-200 status (404 wrong path, 403 auth, 500 crash, 502 proxy error) to the POST of {\"bytes\": N}.","commonSituations":"Misconfigured --limit-manager URL (wrong port/path); rate-limit service not running or behind a proxy returning 502/503; service rejecting unauthenticated requests.","solutions":["Check the wrapped log line 'request traffic control <addr> failed: <err>, http status: <text>' to see the exact status and fix the limiter service or its URL","Verify the --limit-manager address points at the correct host/port/path of the traffic-control service","Confirm the limiter service is running and healthy (curl -X POST the endpoint with {\"bytes\":1024})","If the fallback is acceptable, this is non-fatal: sync continues with local bwlimit or no limit"],"exampleFix":"// before\njuicefs sync a b --cluster w1 --limit-manager http://10.0.0.1:8000/wrong\n// -> http status: Not Found\n// after\njuicefs sync a b --cluster w1 --limit-manager http://10.0.0.1:8000","handlingStrategy":"try-catch","validationCode":"resp, err := http.Post(limitManagerURL, \"application/json\", bytes.NewReader([]byte(`{\"bytes\":1024}`)))\nif err != nil || (resp != nil && resp.StatusCode != http.StatusOK) {\n\tstatus := \"\"\n\tif resp != nil {\n\t\tstatus = http.StatusText(resp.StatusCode)\n\t}\n\tlog.Printf(\"traffic control %s unhealthy (status %s); local bwlimit fallback will be used\", limitManagerURL, status)\n}","typeGuard":null,"tryCatchPattern":"granted, expired, err := limiter.request(ask)\nif err != nil {\n\tvar statusErr = fmt.Errorf(\"http status: %s\", status)\n\tif errors.Is(err, statusErr) {\n\t\tlogger.Warnf(\"limiter %s returned non-200; continuing with local bwlimit fallback\", l.address)\n\t\treturn fallbackLocalLimit(ask)\n\t}\n\treturn 0, 0, err\n}","preventionTips":["Health-check the traffic-control endpoint before starting a limited cluster sync","Use the correct URL/port/path for the limiter service","Remember the error is non-fatal: sync degrades to local bwlimit or unlimited"],"tags":["sync","http","rate-limit","traffic-control"],"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-14T00:17:10.932Z"}