{"record":{"id":"a75d4bc962581bba","repo":"JuliusBrussee/caveman","slug":"rewriter-unsupported-provider-q","errorCode":null,"errorMessage":"rewriter: unsupported provider %q","messagePattern":"rewriter: unsupported provider %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rewriter/rewriter.go","lineNumber":130,"sourceCode":"type Result struct {\n\tRewritten    []byte // includes trailing recovery-pointer line; empty when !Accepted\n\tAccepted     bool\n\tRejectReason string // non-empty when !Accepted; e.g. \"below_theta\", \"gate_failure_tokens\", \"api_error\"\n\tInputTokens  int    // rewriter's own metered usage, for cost netting\n\tOutputTokens int\n\t// CandidateTokens is the inferred size of what the model produced, reported\n\t// on rejected calls so a corpus study can size the rewrites the gate threw\n\t// away. The bytes themselves never leave on a rejection.\n\tCandidateTokens int\n}\n\n// New validates cfg and returns a Client. An unknown provider is an error\n// rather than a default: a silently mis-routed rewriter would produce bytes no\n// gate was designed for.\nfunc New(cfg Config) (*Client, error) {\n\tprovider := strings.ToLower(strings.TrimSpace(cfg.Provider))\n\tif provider != providerAnthropic && provider != providerOpenAI {\n\t\treturn nil, fmt.Errorf(\"rewriter: unsupported provider %q\", cfg.Provider)\n\t}\n\tmodel := strings.TrimSpace(cfg.Model)\n\tif model == \"\" {\n\t\treturn nil, errors.New(\"rewriter: model is required\")\n\t}\n\tif strings.TrimSpace(cfg.APIKey) == \"\" {\n\t\treturn nil, errors.New(\"rewriter: api key is required\")\n\t}\n\ttheta := cfg.Theta\n\tif theta == 0 {\n\t\ttheta = DefaultTheta\n\t}\n\tif theta < 0 {\n\t\treturn nil, fmt.Errorf(\"rewriter: theta must not be negative, got %d\", theta)\n\t}\n\tdoer := cfg.HTTPDoer\n\tif doer == nil {\n\t\tdoer = http.DefaultClient.Do","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/rewriter/rewriter.go#L112-L148","documentation":"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.","triggerScenarios":"Thrown at rewriter/rewriter.go:130 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the rewriter provider to anthropic or openai","Check the config source (env/file) for whitespace or case differences from the two supported names"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"766dce6b1394ebb56a3090748d5a0240a5aefb36","analyzedAt":"2026-08-18T03:14:35.516Z","contentChangedAt":"2026-08-18T03:14:35.516Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}