JuliusBrussee/caveman · error

want provider=https://host

Error message

want provider=https://host

What it means

Returned by (*baseURLValues).Set, the flag.Value implementation for cache-replay's repeatable -base-url flag. Each occurrence must have the form provider=https://host; the value is split on the first '=' and both sides are trimmed, so the error fires when there is no '=', when the provider side is empty, or when the URL side trims to empty. This is purely command-line syntax validation before any URL is used.

Source

Thrown at cacheengine/cmd/cache-replay/main.go:58

	return nil
}

type baseURLValues map[string]string

func (values *baseURLValues) String() string {
	keys := make([]string, 0, len(*values))
	for key := range *values {
		keys = append(keys, key)
	}
	sort.Strings(keys)
	return strings.Join(keys, ",")
}

func (values *baseURLValues) Set(value string) error {
	provider, raw, ok := strings.Cut(value, "=")
	provider = strings.ToLower(strings.TrimSpace(provider))
	if !ok || provider == "" || strings.TrimSpace(raw) == "" {
		return errors.New("want provider=https://host")
	}
	if *values == nil {
		*values = map[string]string{}
	}
	if _, exists := (*values)[provider]; exists {
		return fmt.Errorf("duplicate provider %q", provider)
	}
	(*values)[provider] = strings.TrimSpace(raw)
	return nil
}

type runManifest struct {
	Schema        string                            `json:"schema"`
	Status        string                            `json:"status"`
	Publishable   bool                              `json:"publishable"`
	TraceSHA256   string                            `json:"trace_sha256"`
	StartedAt     string                            `json:"started_at"`
	CompletedAt   string                            `json:"completed_at,omitempty"`

View on GitHub (pinned to 27d5a3981a)

Solutions

  1. Use the exact form: -base-url provider=https://host, e.g. -base-url openai=https://api.staging.example.com
  2. Provider is lower-cased automatically, but it must be non-empty; host must be non-empty after trimming
  3. Repeat the flag for multiple providers; do not comma-separate values in one occurrence
  4. If you also get 'custom base URLs require -allow-custom-base-url', add that flag too

Example fix

# before
cache-replay -trace /abs/t.jsonl -base-url openai.example.com

# after
cache-replay -trace /abs/t.jsonl -base-url openai=https://openai.example.com -allow-custom-base-url
Defensive patterns

Strategy: validation

Validate before calling

func parseBaseURL(v string) (provider, host string, err error) {
	p, raw, ok := strings.Cut(v, "=")
	p, raw = strings.ToLower(strings.TrimSpace(p)), strings.TrimSpace(raw)
	if !ok || p == "" || raw == "" {
		return "", "", fmt.Errorf("want provider=https://host, got %q", v)
	}
	return p, raw, nil
}

Prevention

When it happens

Trigger: Running cache-replay with -base-url openai.example.com (missing '='), -base-url =https://host (empty provider), -base-url openai= (empty host), or -base-url with only whitespace around one side. Shell quoting that swallows the '=' is not the issue here since Cut splits on the first '='.

Common situations: Assuming the flag takes a space-separated pair (-base-url openai https://host); pasting a URL without the provider prefix; trailing-whitespace copy-paste from docs; typos like -base-url openai:https://host.

Related errors


AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15). Data as JSON: /api/errors/8939e46cfe3dbd48. Report an issue: GitHub.