JuliusBrussee/caveman · error

rewriter: unsupported provider %q

Error message

rewriter: unsupported provider %q

What it means

New refused to construct the rewriter Client because cfg.Provider is neither "anthropic" nor "openai" (after lowercase/trim normalization). Only those two provider backends are implemented, so any other string is a configuration typo or an unsupported integration.

Source

Thrown at rewriter/rewriter.go:130

type Result struct {
	Rewritten    []byte // includes trailing recovery-pointer line; empty when !Accepted
	Accepted     bool
	RejectReason string // non-empty when !Accepted; e.g. "below_theta", "gate_failure_tokens", "api_error"
	InputTokens  int    // rewriter's own metered usage, for cost netting
	OutputTokens int
	// CandidateTokens is the inferred size of what the model produced, reported
	// on rejected calls so a corpus study can size the rewrites the gate threw
	// away. The bytes themselves never leave on a rejection.
	CandidateTokens int
}

// New validates cfg and returns a Client. An unknown provider is an error
// rather than a default: a silently mis-routed rewriter would produce bytes no
// gate was designed for.
func New(cfg Config) (*Client, error) {
	provider := strings.ToLower(strings.TrimSpace(cfg.Provider))
	if provider != providerAnthropic && provider != providerOpenAI {
		return nil, fmt.Errorf("rewriter: unsupported provider %q", cfg.Provider)
	}
	model := strings.TrimSpace(cfg.Model)
	if model == "" {
		return nil, errors.New("rewriter: model is required")
	}
	if strings.TrimSpace(cfg.APIKey) == "" {
		return nil, errors.New("rewriter: api key is required")
	}
	theta := cfg.Theta
	if theta == 0 {
		theta = DefaultTheta
	}
	if theta < 0 {
		return nil, fmt.Errorf("rewriter: theta must not be negative, got %d", theta)
	}
	doer := cfg.HTTPDoer
	if doer == nil {
		doer = http.DefaultClient.Do

View on GitHub (pinned to 766dce6b13)

Solutions

  1. Set the rewriter provider to anthropic or openai
  2. Check the config source (env/file) for whitespace or case differences from the two supported names
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at rewriter/rewriter.go:130 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of JuliusBrussee/caveman@766dce6b13 (2026-08-18). Data as JSON: /api/errors/a75d4bc962581bba. Report an issue: GitHub.