Skip to content

Hardcoded patterns missing "free usage" / "usage exceeded" #22

Description

@brucekinsey

Plugin version

1.3.4

OpenCode version

1.15.0

What happened?

The plugin's hardcoded classifyError() function uses internal pattern lists (RATE_LIMIT_PATTERNS, QUOTA_PATTERNS, etc.) that don't include "free usage" or "usage exceeded". When a provider returns an error like "Free usage exceeded, subscribe to Go", classifyError returns "unknown", which isn't a valid fallbackOn category. This means the plugin never marks the model as rate_limited, and the proactive chat.message redirect never activates for this error.

I patched both DEFAULT_PATTERNS and QUOTA_PATTERNS locally to add "free usage" and "usage exceeded" — that fixed the issue. Would be great if these strings were included in the default/QUOTA patterns upstream.

What did you expect?

Errors containing "free usage" or "usage exceeded" should be classified as "quota_exceeded" and trigger the fallback chain without requiring a source code patch.

Your model-fallback.json config (redact sensitive values)

{"enabled":true,"defaults":{"fallbackOn":["rate_limit","quota_exceeded","5xx","timeout","overloaded"],"cooldownMs":300000,"retryOriginalAfterMs":600000,"maxFallbackDepth":3},"patterns":["free usage","usage exceeded","rate limit","ratelimit","usage limit","too many requests","quota exceeded","overloaded","capacity exceeded","credits exhausted","insufficient credit","billing limit","resource exhausted","429"],"agents":{"*":{"fallbackModels":["opencode-go/deepseek-v4-flash","opencode-go/qwen3.5-plus","opencode-go/minimax-m2.5"]}},"logging":true,"logLevel":"debug"}

Relevant log output

{"level":"debug","event":"retry.ignored","category":"unknown","messageLength":36}

The 36-char message was "Free usage exceeded, subscribe to Go".

Steps to reproduce

  1. Configure a fallback chain
  2. Use a model that returns "Free usage exceeded" or "usage exceeded" on exhaustion
  3. Observe retry.ignored with category: "unknown" in the logs
  4. The model is never marked rate_limited, so proactive redirect never activates

Operating system

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions