wtfutil/wtf · error

invalid status page URL format. Expected '.../status/<slug>'

Error message

invalid status page URL format. Expected '.../status/<slug>'

What it means

The Uptime Kuma widget expects a status-page URL of the form '<base>/status/<slug>'. parseURL splits the URL path on '/' after trimming slashes; if there are fewer than two path segments or the first segment is not literally 'status', it throws this error. The slug and base URL are required to build the API endpoints.

Source

Thrown at modules/uptimekuma/widget.go:227

		return nil, err
	}

	return &data, nil
}

func parseURL(rawURL string) (string, string, error) {
	if rawURL == "" {
		return "", "", fmt.Errorf("URL is not defined")
	}

	u, err := url.Parse(rawURL)
	if err != nil {
		return "", "", fmt.Errorf("invalid URL: %w", err)
	}

	parts := strings.Split(strings.Trim(u.Path, "/"), "/")
	if len(parts) < 2 || parts[0] != "status" {
		return "", "", fmt.Errorf("invalid status page URL format. Expected '.../status/<slug>'")
	}

	slug := parts[1]
	baseURL := fmt.Sprintf("%s://%s", u.Scheme, u.Host)

	return baseURL, slug, nil
}

View on GitHub (pinned to bb838c1ccb)

Solutions

  1. Use the public status page URL exactly as shown in Uptime Kuma, including /status/<slug>: https://your-uptime/status/main
  2. Find the slug in Uptime Kuma under Status Pages settings (the editable URL segment) and append it to the URL
  3. If serving under a subpath, ensure the /status/<slug> portion is still present in the configured URL

Example fix

// before
url: "https://uptime.example.com"
// after
url: "https://uptime.example.com/status/main"
Defensive patterns

Strategy: validation

Validate before calling

u, _ := url.Parse(cfg.URL)
segs := strings.Split(strings.Trim(u.Path, "/"), "/")
if len(segs) < 2 || segs[0] != "status" || segs[1] == "" {
    return fmt.Errorf("uptimekuma url must end in /status/<slug>, got path %q", u.Path)
}

Prevention

When it happens

Trigger: Refresh calls parseURL with a valid URL whose path is not '.../status/<slug>' — e.g. url: "https://uptime.example.com" (no path), url: "https://uptime.example.com/dashboard/main", or url: "https://uptime.example.com/status/" (empty slug).

Common situations: Users paste the Uptime Kuma dashboard URL or bare instance URL instead of the public status page URL; leaving off the slug; using a reverse-proxy path prefix that changes the path layout.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


AI-assisted analysis of wtfutil/wtf@bb838c1ccb (2026-09-03). Data as JSON: /api/errors/574149cbf10731cc. Report an issue: GitHub.