dagger/dagger · error
URL must start with http:// or https://
Error message
URL must start with http:// or https://
What it means
Form validation error requiring the endpoint URL scheme to be http or https. The library throws it when the parsed URL has a different or missing scheme, since custom LLM servers must be reached over HTTP(S).
Source
Thrown at internal/cmd/dagger/llmconfig/setup.go:864
var endpoint string
form := huh.NewForm(
huh.NewGroup(
huh.NewInput().
Title("Endpoint URL").
Description("The base URL of your local LLM server (e.g. http://192.168.2.225:1234).").
Placeholder("http://localhost:11434").
Value(&endpoint).
Validate(func(s string) error {
s = strings.TrimSpace(s)
if s == "" {
return fmt.Errorf("endpoint URL is required")
}
u, err := url.Parse(s)
if err != nil {
return fmt.Errorf("invalid URL: %w", err)
}
if u.Scheme != "http" && u.Scheme != "https" {
return fmt.Errorf("URL must start with http:// or https://")
}
if u.Host == "" {
return fmt.Errorf("URL must include a host")
}
return nil
}),
),
)
if err := checkAbort(ph.HandleForm(ctx, form)); err != nil {
return "", nil, "", err
}
endpoint = strings.TrimSpace(endpoint)
// Strip trailing slash for consistency
endpoint = strings.TrimRight(endpoint, "/")
var compat string
compatForm := huh.NewForm(
huh.NewGroup(View on GitHub (pinned to 82ba2681db)
Solutions
- Prefix the endpoint with http:// (or https:// for TLS): http://localhost:11434.
- Do not use unix:// or other schemes; the client speaks HTTP only.
- If your server is plain HTTP on localhost, http:// is correct — https is not required locally.
Example fix
// before Endpoint: "localhost:11434" // after Endpoint: "http://localhost:11434"
Defensive patterns
Strategy: validation
Validate before calling
u, _ := url.Parse(strings.TrimSpace(endpoint))
if u.Scheme != "http" && u.Scheme != "https" {
return fmt.Errorf("URL must start with http:// or https://")
} Prevention
- Always prefix host:port with http:// or https://.
- Do not assume a default scheme is added.
- Avoid non-HTTP schemes (unix://, ftp://).
When it happens
Trigger: Submitting the endpoint form with values like "localhost:11434", "192.168.2.225:1234", "ftp://...", or "unix:///path" — anything without an explicit http:// or https:// prefix.
Common situations: User omits the scheme because browsers tolerate it; copying a host:port pair from docs without the prefix; assuming a default scheme is applied.
Related errors
- invalid URL: %w
- URL must include a host
- parse runner host: %w
- %s cannot be empty
- endpoint URL is required
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/85e7687207cb6174.
Report an issue: GitHub.