{"record":{"id":"589f1e35f02d5ebd","repo":"JuliusBrussee/caveman","slug":"rewriter-model-is-required","errorCode":null,"errorMessage":"rewriter: model is required","messagePattern":"rewriter: model is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rewriter/rewriter.go","lineNumber":134,"sourceCode":"\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\n\t}\n\treturn &Client{provider: provider, model: model, apiKey: cfg.APIKey, theta: theta, doer: doer}, nil\n}\n","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/rewriter/rewriter.go#L116-L152","documentation":"Error \"rewriter: model is required\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at rewriter/rewriter.go:134 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the rewriter model."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}