GoogleContainerTools/skaffold · error

%s is not a valid URL

Error message

%s is not a valid URL

What it means

downloadFromURL validates each manifest string with util.IsURL before fetching. An empty string or anything that is not an http(s)/gcs-style URL fails validation and returns this error, aborting that manifest's download.

Source

Thrown at pkg/skaffold/kubernetes/manifest/url.go:52

	dir := filepath.Join(ManifestTmpDir, ManifestsFromURL)
	if err := os.MkdirAll(dir, os.ModePerm); err != nil {
		return nil, fmt.Errorf("failed to create the tmp directory: %w", err)
	}
	var paths []string
	for _, manifest := range manifests {
		out, err := downloadFromURL(dir, manifest)

		if err != nil {
			return nil, err
		}
		paths = append(paths, out)
	}
	return paths, nil
}

func downloadFromURL(destDir string, manifest string) (string, error) {
	if manifest == "" || !util.IsURL(manifest) {
		return "", fmt.Errorf("%s is not a valid URL", manifest)
	}

	resp, err := http.Get(manifest)
	if err != nil {
		return "", fmt.Errorf("failed to download manifest from %s, err : %w", manifest, err)
	}
	defer resp.Body.Close()

	f, err := os.CreateTemp(destDir, "*.yaml")
	if err != nil {
		return "", fmt.Errorf("failed to create manifest file: %w", err)
	}
	defer f.Close()
	_, err = io.Copy(f, resp.Body)
	if err != nil {
		return "", fmt.Errorf("failed to write manifest to file, err: %w", err)
	}

View on GitHub (pinned to a1189de023)

Solutions

  1. Correct the manifest entry to a full valid URL, e.g. https://host/path/manifest.yaml
  2. Remove empty entries from the manifests list
  3. For local files, use the local file manifest source instead of url:

Example fix

# before
- manifests:
  - ""
# after
- manifests:
  - "https://raw.githubusercontent.com/org/repo/main/k8s/deploy.yaml"
Defensive patterns

Strategy: validation

Validate before calling

for _, u := range manifests {
    if u == "" || !util.IsURL(u) {
        return fmt.Errorf("manifest %q is not a valid URL", u)
    }
}

Type guard

func isHTTPURL(s string) bool {
    u, err := url.Parse(s)
    return err == nil && (u.Scheme == "http" || u.Scheme == "https") && u.Host != ""
}

Prevention

When it happens

Trigger: Passing an empty string, a local file path, or a malformed URL (missing scheme, spaces) in the manifests list given to DownloadFromURL / resolveRemoteAndLocal.

Common situations: skaffold config listing local paths mixed with remote URLs in a url: manifest source; typos like 'htp://'; env-var interpolation leaving an empty value.

Understand the failure class

Background: "Invalid URL" / "URL cannot be empty": fix the malformed or missing URL behind request-construction failures — this error's family across 50 libraries.

Related errors


AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05). Data as JSON: /api/errors/2f2b0ad4afe9e02c. Report an issue: GitHub.