{"record":{"id":"516e466e9375e1e6","repo":"caddyserver/caddy","slug":"upstream-response-matched-retry-match-status-d","errorCode":null,"errorMessage":"upstream response matched retry_match (status %d)","messagePattern":"upstream response matched retry_match \\(status (.+?)\\)","errorType":"exception","errorClass":"retryableResponseError","httpStatus":null,"severity":"error","filePath":"modules/caddyhttp/reverseproxy/reverseproxy.go","lineNumber":1145,"sourceCode":"\t// that contain at least one expression matcher, since those are\n\t// the ones that can reference response data ({rp.status_code},\n\t// {rp.header.*}). Pure request-only matchers (method, path, etc.)\n\t// are skipped to avoid retrying every response that matches a\n\t// request condition\n\tif h.LoadBalancing != nil && len(h.LoadBalancing.RetryMatch) > 0 {\n\t\tfor _, matcherSet := range h.LoadBalancing.RetryMatch {\n\t\t\tif !matcherSetHasExpressionMatcher(matcherSet) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tmatch, err := matcherSet.MatchWithError(req)\n\t\t\tif err != nil {\n\t\t\t\th.logger.Error(\"error matching request for retry\", zap.Error(err))\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif match {\n\t\t\t\tres.Body.Close()\n\t\t\t\treturn retryableResponseError{\n\t\t\t\t\terror:      fmt.Errorf(\"upstream response matched retry_match (status %d)\", res.StatusCode),\n\t\t\t\t\tstatusCode: res.StatusCode,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// see if any response handler is configured for this response from the backend\n\tfor i, rh := range h.HandleResponse {\n\t\tif rh.Match != nil && !rh.Match.Match(res.StatusCode, res.Header) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// if configured to only change the status code,\n\t\t// do that then continue regular proxy response\n\t\tif statusCodeStr := rh.StatusCode.String(); statusCodeStr != \"\" {\n\t\t\tstatusCode, err := strconv.Atoi(repl.ReplaceAll(statusCodeStr, \"\"))\n\t\t\tif err != nil {\n\t\t\t\treturn caddyhttp.Error(http.StatusInternalServerError, err)","sourceCodeStart":1127,"sourceCodeEnd":1163,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/modules/caddyhttp/reverseproxy/reverseproxy.go#L1127-L1163","documentation":"Error \"upstream response matched retry_match (status %d)\" thrown in caddyserver/caddy.","triggerScenarios":"Thrown at modules/caddyhttp/reverseproxy/reverseproxy.go:1145 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Adjust the retry_match criteria or fix the upstream so it does not return the matched status, if retries are not desired."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}