{"record":{"id":"f35a66186ed4483f","repo":"JuliusBrussee/caveman","slug":"s-s-s-unsupported-currency-q","errorCode":null,"errorMessage":"%s %s/%s: unsupported currency %q","messagePattern":"(.+?) (.+?)/(.+?): unsupported currency %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shared/platform/catalog/catalog.go","lineNumber":326,"sourceCode":"\t}\n\tvar trailing any\n\tif err := dec.Decode(&trailing); err != io.EOF {\n\t\tif err == nil {\n\t\t\treturn nil, fmt.Errorf(\"multiple YAML documents are not allowed\")\n\t\t}\n\t\treturn nil, err\n\t}\n\tif len(decoded) == 0 {\n\t\treturn nil, fmt.Errorf(\"catalog is empty\")\n\t}\n\tseen := make(map[string]struct{}, len(decoded))\n\tfor i, entry := range decoded {\n\t\tlabel := fmt.Sprintf(\"entry %d\", i)\n\t\tif strings.TrimSpace(entry.Provider) == \"\" || strings.TrimSpace(entry.Model) == \"\" || strings.TrimSpace(entry.Region) == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"%s: provider, model, and region are required\", label)\n\t\t}\n\t\tif entry.Currency != \"USD\" {\n\t\t\treturn nil, fmt.Errorf(\"%s %s/%s: unsupported currency %q\", label, entry.Provider, entry.Model, entry.Currency)\n\t\t}\n\t\tif !cost.ValidPrice(entry.Pricing) {\n\t\t\treturn nil, fmt.Errorf(\"%s %s/%s: invalid pricing\", label, entry.Provider, entry.Model)\n\t\t}\n\t\tverified, err := time.Parse(time.RFC3339, entry.VerifiedAt)\n\t\tif err != nil || verified.IsZero() {\n\t\t\treturn nil, fmt.Errorf(\"%s %s/%s: verified_at must be RFC3339\", label, entry.Provider, entry.Model)\n\t\t}\n\t\tif verified.After(time.Now().UTC().Add(24 * time.Hour)) {\n\t\t\treturn nil, fmt.Errorf(\"%s %s/%s: verified_at is in the future\", label, entry.Provider, entry.Model)\n\t\t}\n\t\tif entry.CapabilitiesVerifiedAt != \"\" {\n\t\t\tcapVerified, err := time.Parse(time.RFC3339, entry.CapabilitiesVerifiedAt)\n\t\t\tif err != nil || capVerified.IsZero() {\n\t\t\t\treturn nil, fmt.Errorf(\"%s %s/%s: capabilities_verified_at must be RFC3339\", label, entry.Provider, entry.Model)\n\t\t\t}\n\t\t\tif capVerified.After(time.Now().UTC().Add(24 * time.Hour)) {\n\t\t\t\treturn nil, fmt.Errorf(\"%s %s/%s: capabilities_verified_at is in the future\", label, entry.Provider, entry.Model)","sourceCodeStart":308,"sourceCodeEnd":344,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/shared/platform/catalog/catalog.go#L308-L344","documentation":"Catalog validation error from DecodeAndValidate: a pricing entry declares a currency the platform does not support. The entry is labeled provider/model/region so the offending row is identifiable; unsupported currencies would break cost math downstream.","triggerScenarios":"DecodeAndValidate sees an entry whose currency field is not exactly 'USD' (e.g. 'EUR', 'eur', 'usd', or empty).","commonSituations":"Entries imported from a European or regional price list without conversion, lowercase currency codes from another tool, or a currency field accidentally dropped during editing.","solutions":["Set currency: USD on the reported entry.","Convert the source prices to USD (at a documented rate) and record verification in verified_at/sources.","Check casing — only the exact string 'USD' is accepted.","If multi-currency support is needed, extend the library rather than smuggling other codes in."],"exampleFix":"# before\ncurrency: eur\n# after\ncurrency: USD","handlingStrategy":"validation","validationCode":"if e.Currency != \"USD\" {\n\treturn fmt.Errorf(\"currency must be USD, got %q\", e.Currency)\n}","typeGuard":null,"tryCatchPattern":"if _, err := catalog.DecodeAndValidate(raw); err != nil {\n\tif strings.Contains(err.Error(), \"unsupported currency\") {\n\t\treturn fmt.Errorf(\"convert prices to USD before ingest: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Normalize all price sources to USD at collection time","Use exact uppercase 'USD' everywhere; add a linter check","Document FX conversion in verified_at/sources when converting"],"tags":["catalog","currency","pricing"],"backgroundTag":"unsupported-enum-value","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}