AlistGo/alist · error

invalid format: %s

Error message

invalid format: %s

What it means

Thrown while parsing the github_releases driver's mount-point configuration. Each non-empty config line must be either 'repo' (mounted at /) or 'path:repo' (path first, repo second). A line containing two or more ':' characters does not match either shape and is rejected with 'invalid format: <line>'.

Source

Thrown at drivers/github_releases/util.go:49

// 解析挂载结构
func (d *GithubReleases) ParseRepos(text string) ([]MountPoint, error) {
	lines := strings.Split(text, "\n")
	points := make([]MountPoint, 0)
	for _, line := range lines {
		line = strings.TrimSpace(line)
		if line == "" {
			continue
		}
		parts := strings.Split(line, ":")
		path, repo := "", ""
		if len(parts) == 1 {
			path = "/"
			repo = parts[0]
		} else if len(parts) == 2 {
			path = fmt.Sprintf("/%s", strings.Trim(parts[0], "/"))
			repo = parts[1]
		} else {
			return nil, fmt.Errorf("invalid format: %s", line)
		}

		points = append(points, MountPoint{
			Point:    path,
			Repo:     repo,
			Release:  nil,
			Releases: nil,
		})
	}
	d.points = points
	return points, nil
}

// 获取下一级目录
func GetNextDir(wholePath string, basePath string) string {
	basePath = fmt.Sprintf("%s/", strings.TrimRight(basePath, "/"))
	if !strings.HasPrefix(wholePath, basePath) {
		return ""

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Use exactly one colon: '/mount/path:owner/repo', or a bare 'owner/repo' for root mount
  2. Replace full URLs with the owner/repo form, e.g. 'github.com/org/repo' -> 'org/repo' (strip scheme and host)
  3. Remove SSH-style prefixes like 'git@github.com:' before the owner/repo part

Example fix

// before
mount: https://github.com:443/alistgo/alist
// invalid format: https://github.com:443/alistgo/alist

// after
/: alistgo/alist
/media: alistgo/alist
Defensive patterns

Strategy: validation

Validate before calling

func validMountLine(line string) bool {
  parts := strings.Split(line, ":")
  if len(parts) > 2 { return false }
  repo := parts[len(parts)-1]
  seg := strings.Split(strings.Trim(repo, "/"), "/")
  return len(seg) == 2 && seg[0] != "" && seg[1] != "" && !strings.Contains(repo, "://")
}

Prevention

When it happens

Trigger: Calling the mount-point parser (init/read of github_releases driver config) with a line like 'a:b:c' or a repo URL containing a colon such as 'https://github.com:user/repo' or 'media:github.com/org/repo'. strings.Split(line, ':') yields >2 parts and the else-branch returns the error.

Common situations: User enters a full HTTPS clone URL instead of owner/repo; user writes 'path:owner:repo' expecting multiple segments; stray colon from copy-pasting 'git@github.com:org/repo.git' SSH URLs; trailing 'driveletter:-style' artifacts on Windows configs.

Related errors


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