AlistGo/alist · error

e.Message

Error message

e.Message

What it means

The Teambition request wrapper unmarshals non-2xx/API-error bodies into ErrResp and, when the error has a Name, returns errors.New(e.Message) — surfacing the server's own error text (this lookup key is literally 'e.Message'). Whatever Message the Teambition API put in the error body is what the caller sees, e.g. invalid token, expired session, or object-not-found messages.

Source

Thrown at drivers/teambition/util.go:51

	if d.isInternational() {
		url = "https://us.teambition.com" + pathname
	}
	req := base.RestyClient.R()
	req.SetHeader("Cookie", d.Cookie)
	if callback != nil {
		callback(req)
	}
	if resp != nil {
		req.SetResult(resp)
	}
	var e ErrResp
	req.SetError(&e)
	res, err := req.Execute(method, url)
	if err != nil {
		return nil, err
	}
	if e.Name != "" {
		return nil, errors.New(e.Message)
	}
	return res.Body(), nil
}

func (d *Teambition) getFiles(parentId string) ([]model.Obj, error) {
	files := make([]model.Obj, 0)
	page := 1
	for {
		var collections []Collection
		_, err := d.request("/api/collections", http.MethodGet, func(req *resty.Request) {
			req.SetQueryParams(map[string]string{
				"_parentId":  parentId,
				"_projectId": d.ProjectID,
				"order":      d.OrderBy + d.OrderDirection,
				"count":      "50",
				"page":       strconv.Itoa(page),
			})
		}, &collections)

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Re-authenticate: update the storage's cookie/token in alist and re-save to re-run Init
  2. Verify the target object still exists in the Teambition UI and retry
  3. Inspect the full response body (add temporary logging of res.Body()) if the Message is vague, then act on the specific API error
  4. Check for region/endpoint mismatch in the driver config if auth repeatedly fails with cryptic messages
Defensive patterns

Strategy: try-catch

Try / catch

body, err := d.request("/api/...", http.MethodGet, cb, &out)
if err != nil {
    msg := err.Error()
    switch {
    case strings.Contains(msg, "token"), strings.Contains(msg, "unauthorized"), strings.Contains(msg, "login"):
        // refresh cookie/token in storage config, then retry once
    case strings.Contains(msg, "not found"):
        // object deleted upstream — drop from cache
    default:
        return fmt.Errorf("teambition api: %w", err)
    }
}

Prevention

When it happens

Trigger: Any Teambition API call whose JSON response contains a non-empty Name field in the error structure — expired/invalid cookie or authorization, deleted target collection, quota errors, or rate limiting as reported by the API.

Common situations: Login cookie/token expired (most common) — refresh credentials in the storage config; Operating on a collection/task deleted in the Teambition web client concurrently; Account-level issues: 2FA enabled, session revoked, or API region mismatch (teambition.com vs teambition.cn)

Related errors


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