JuliusBrussee/caveman · error

/ : at least one source is required

Error message

%s %s/%s: at least one source is required

What it means

DecodeAndValidate requires every catalog entry to cite at least one provenance source URL. An entry with an empty or missing sources array is rejected because the catalog's safety story depends on verifiable evidence per model entry. This fails closed at decode time.

Solutions

  1. Add at least one HTTPS source URL documenting the model's capabilities to the entry's sources array.
  2. If generating the catalog, ensure the generator always emits a non-empty sources list for every entry.
  3. Re-run DecodeAndValidate to verify the entry passes.

Example fix

// before
{
  "provider": "openai",
  "model": "gpt-5",
  "sources": []
}
// after
{
  "provider": "openai",
  "model": "gpt-5",
  "sources": ["https://platform.openai.com/docs/models/gpt-5"]
}
Defensive patterns

Strategy: validation

Validate before calling

if len(entry.Sources) == 0 {
    return fmt.Errorf("entry %s/%s missing sources", entry.Provider, entry.Model)
}
for _, s := range entry.Sources {
    if u, err := url.ParseRequestURI(s); err != nil || u.Scheme != "https" || u.Host == "" {
        return fmt.Errorf("entry %s/%s invalid source %q", entry.Provider, entry.Model, s)
    }
}

Try / catch

decoded, err := catalog.DecodeAndValidate(raw, label)
if err != nil {
    if strings.Contains(err.Error(), "at least one source is required") {
        return fmt.Errorf("catalog entry missing provenance: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: Calling DecodeAndValidate (or load/loadCurrentCatalog/snapshotDrift) on a catalog where an entry has sources: [] or omits the sources field entirely.

Common situations: Hand-writing a new model entry and forgetting to add source links; a script that strips fields when regenerating the catalog; a merge that dropped the sources key.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20). Data as JSON: /api/errors/e72c1f84ef9bd820. Report an issue: GitHub.

Appendix: source

Thrown at shared/platform/catalog/catalog.go:348

		}
		verified, err := time.Parse(time.RFC3339, entry.VerifiedAt)
		if err != nil || verified.IsZero() {
			return nil, fmt.Errorf("%s %s/%s: verified_at must be RFC3339", label, entry.Provider, entry.Model)
		}
		if verified.After(time.Now().UTC().Add(24 * time.Hour)) {
			return nil, fmt.Errorf("%s %s/%s: verified_at is in the future", label, entry.Provider, entry.Model)
		}
		if entry.CapabilitiesVerifiedAt != "" {
			capVerified, err := time.Parse(time.RFC3339, entry.CapabilitiesVerifiedAt)
			if err != nil || capVerified.IsZero() {
				return nil, fmt.Errorf("%s %s/%s: capabilities_verified_at must be RFC3339", label, entry.Provider, entry.Model)
			}
			if capVerified.After(time.Now().UTC().Add(24 * time.Hour)) {
				return nil, fmt.Errorf("%s %s/%s: capabilities_verified_at is in the future", label, entry.Provider, entry.Model)
			}
		}
		if len(entry.Sources) == 0 {
			return nil, fmt.Errorf("%s %s/%s: at least one source is required", label, entry.Provider, entry.Model)
		}
		for _, rawURL := range entry.Sources {
			u, err := url.ParseRequestURI(rawURL)
			if err != nil || u.Scheme != "https" || u.Host == "" {
				return nil, fmt.Errorf("%s %s/%s: invalid HTTPS source %q", label, entry.Provider, entry.Model, rawURL)
			}
		}
		key := entry.Provider + "\x00" + entry.Model + "\x00" + entry.Region
		if _, duplicate := seen[key]; duplicate {
			return nil, fmt.Errorf("duplicate provider/model/region row %s/%s@%s", entry.Provider, entry.Model, entry.Region)
		}
		seen[key] = struct{}{}
	}
	return decoded, nil
}

// catalogCandidates lists the paths to try, in order: an explicit env override,
// the deploy-image and CWD-relative locations, then a walk up from the working

View on GitHub (pinned to 3ee70a1026)