mickael-kerjean/filestash · error

HTTP Error %d

Error message

HTTP Error %d

What it means

Thrown by the URL backend's Ls when an HTTP GET on the target URL returns a status that is neither 200, 404 (mapped to ErrNotFound), nor 403 (mapped to ErrNotAllowed). It is a catch-all for other HTTP failures — 5xx server errors, redirects gone wrong, 429 rate limiting — encountered while listing a remote URL as a filesystem.

Source

Thrown at server/plugin/plg_backend_url/index.go:105

}

func (this *Url) Ls(path string) ([]os.FileInfo, error) {
	this.root.Path = path
	if strings.HasSuffix(this.root.Path, "/") == false {
		this.root.Path += "/"
	}
	resp, err := this.request(http.MethodGet, this.root.String(), "")
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	if resp.StatusCode != http.StatusOK {
		if resp.StatusCode == http.StatusNotFound {
			return nil, ErrNotFound
		} else if resp.StatusCode == http.StatusForbidden {
			return nil, ErrNotAllowed
		}
		return nil, fmt.Errorf("HTTP Error %d", resp.StatusCode)
	}
	utf8Body, err := charset.NewReader(resp.Body, resp.Header.Get("Content-Type"))
	if err != nil {
		return nil, err
	}
	doc, err := html.Parse(utf8Body)
	if err != nil {
		return nil, err
	}
	var links []os.FileInfo
	var crawler func(*html.Node)
	crawler = func(node *html.Node) {
		if node.Type == html.ElementNode && slices.Contains([]string{"a", "img", "object", "iframe"}, strings.ToLower(node.Data)) {
			for _, attr := range node.Attr {
				link := ""
				if strings.ToLower(attr.Key) == "href" {
					link = attr.Val
				}

View on GitHub (pinned to 78f756eb94)

Solutions

  1. Check the reported status code: 5xx means the remote server failed, retry later; 429 means rate limiting, back off
  2. Confirm the URL is correct and resolves to a directory-style listing (index page), not an unexpected endpoint
  3. Follow redirects explicitly if the remote returns 3xx after redirects are exhausted
  4. Handle known codes with dedicated errors (like 404/403 already are) to give callers precise semantics
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at server/plugin/plg_backend_url/index.go:105 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of mickael-kerjean/filestash@78f756eb94 (2026-09-06). Data as JSON: /api/errors/f056f0e61ba5bfa7. Report an issue: GitHub.