AlistGo/alist · error

owner and repo are required

Error message

owner and repo are required

What it means

Gitee driver initialization validates that both the Owner and Repo configuration fields are set after trimming whitespace; if either is empty, Init fails immediately with this error before any API call is made. It prevents constructing an invalid base URL like /api/v5/repos//contents.

Source

Thrown at drivers/gitee/driver.go:46

}

func (d *Gitee) GetAddition() driver.Additional {
	return &d.Addition
}

func (d *Gitee) Init(ctx context.Context) error {
	d.RootFolderPath = utils.FixAndCleanPath(d.RootFolderPath)
	d.Endpoint = strings.TrimSpace(d.Endpoint)
	if d.Endpoint == "" {
		d.Endpoint = "https://gitee.com/api/v5"
	}
	d.Endpoint = strings.TrimSuffix(d.Endpoint, "/")
	d.Owner = strings.TrimSpace(d.Owner)
	d.Repo = strings.TrimSpace(d.Repo)
	d.Token = strings.TrimSpace(d.Token)
	d.DownloadProxy = strings.TrimSpace(d.DownloadProxy)
	if d.Owner == "" || d.Repo == "" {
		return errors.New("owner and repo are required")
	}
	d.client = base.NewRestyClient().
		SetBaseURL(d.Endpoint).
		SetHeader("Accept", "application/json")
	repo, err := d.getRepo()
	if err != nil {
		return err
	}
	d.Ref = strings.TrimSpace(d.Ref)
	if d.Ref == "" {
		d.Ref = repo.DefaultBranch
	}
	return nil
}

func (d *Gitee) Drop(ctx context.Context) error {
	return nil
}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Open the storage configuration for the Gitee mount and fill in both the owner (user or org name) and repo fields.
  2. Confirm the values against the Gitee URL: https://gitee.com/<owner>/<repo>.
  3. Re-save the storage so Init runs again and validates cleanly.

Example fix

// before: storage config with empty fields
Owner: "",
Repo: "my-repo"

// after
Owner: "my-org",
Repo: "my-repo"
Defensive patterns

Strategy: validation

Validate before calling

owner := strings.TrimSpace(cfg.Owner)
repo := strings.TrimSpace(cfg.Repo)
if owner == "" || repo == "" {
    return fmt.Errorf("gitee storage needs owner and repo, got owner=%q repo=%q", owner, repo)
}

Prevention

When it happens

Trigger: Adding or updating a Gitee storage mount where the 'owner' or 'repo' addition field is empty or contains only whitespace. drivers/gitee/driver.go:46 in Init().

Common situations: User filled the root folder path but left owner/repo blank; a copy of an existing storage config with the fields cleared; leading/trailing spaces or an invisible character making the field effectively empty after TrimSpace.

Related errors


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