AlistGo/alist · error

invalid response

Error message

invalid response

What it means

getContent() unmarshalled the Gitee contents API response successfully, but the resulting Content.Type field was empty, so the driver treats the response as invalid — it cannot tell file from directory without 'type'. This usually means the endpoint returned something other than the expected content object (an error page, an auth challenge, or a bare 404 body that still parsed as JSON).

Source

Thrown at drivers/gitee/driver.go:173

		contents[i].Path = joinPath(path, contents[i].Name)
	}
	return contents, nil
}

func (d *Gitee) getContent(path string) (*Content, error) {
	res, err := d.newRequest().Get(d.apiPath(path))
	if err != nil {
		return nil, err
	}
	if res.IsError() {
		return nil, toErr(res)
	}
	var content Content
	if err := utils.Json.Unmarshal(res.Body(), &content); err != nil {
		return nil, err
	}
	if content.Type == "" {
		return nil, errors.New("invalid response")
	}
	if content.Path == "" {
		content.Path = path
	}
	return &content, nil
}

func (d *Gitee) relativePath(full string) string {
	full = utils.FixAndCleanPath(full)
	root := utils.FixAndCleanPath(d.RootFolderPath)
	if root == "/" {
		return strings.TrimPrefix(full, "/")
	}
	if utils.PathEqual(full, root) {
		return ""
	}
	prefix := utils.PathAddSeparatorSuffix(root)
	if strings.HasPrefix(full, prefix) {

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Set a valid access token in the storage config to raise rate limits and authorize private repos.
  2. Verify the Endpoint is the default https://gitee.com/api/v5 (or a compatible v5 mirror).
  3. Confirm the path exists on the configured ref/branch and the owner/repo are correct.
  4. If it recurs, log res.Body() to inspect the actual payload Gitee returned.
Defensive patterns

Strategy: retry

Validate before calling

if d.Token == "" && time.Since(lastUnauthReq) < time.Minute {
    return errors.New("gitee unauthenticated rate limit; set a token")
}

Try / catch

content, err := d.getContent(path)
if err != nil {
    if err.Error() == "invalid response" {
        time.Sleep(backoff) // likely rate-limited
        content, err = d.getContent(path)
    }
}

Prevention

When it happens

Trigger: GET {endpoint}/repos/{owner}/{repo}/contents/{path} returning HTTP 200 with a JSON body lacking the 'type' field — e.g. rate-limit message, HTML wrapped as JSON, empty object from a wrong endpoint, or a path that resolved to nothing. drivers/gitee/driver.go:173.

Common situations: Unauthenticated requests against Gitee's 60-req/hour limit hitting a rate-limit body; wrong Endpoint override pointing at a non-v5 API; private repo with an invalid token returning an error object; requesting a path that does not exist in the configured ref.

Related errors


AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15). Data as JSON: /api/errors/c363b6cef095173a. Report an issue: GitHub.