@@ -438,7 +438,8 @@ func (a *anthropicClient) shouldRetry(attempts int, err error) (bool, int64, err
438438func (a *anthropicClient) handleContextLimitError(apiErr *anthropic.Error) (int, bool) {
439439 // Parse error message like: "input length and max_tokens exceed context limit: 154978 + 50000 > 200000"
440440 errorMsg := apiErr.Error()
441− re := regexp.MustCompile(`input length and max_tokens exceed context limit: (\d+) \+ (\d+) > (\d+)`)
441+
442+ re := regexp.MustCompile("input length and `max_tokens` exceed context limit: (\\d+) \\+ (\\d+) > (\\d+)")
442443 matches := re.FindStringSubmatch(errorMsg)
443444
444445 if len(matches) != 4 {