AlistGo/alist · error

illegal title, only supports 50 characters

Error message

illegal title, only supports 50 characters

What it means

The Baidu Photo union API returned errno 50100, mapped in Request (drivers/baidu_photo/utils.go:50) to 'illegal title, only supports 50 characters'. Album names (create via CreateAlbum, rename via SetAlbumName, both reachable from MakeDir/Rename in driver.go) are validated server-side: the title must be at most 50 characters and use characters Baidu accepts.

Source

Thrown at drivers/baidu_photo/utils.go:50

	}
	if resp != nil {
		req.SetResult(resp)
	}
	res, err := req.Execute(method, furl)
	if err != nil {
		return nil, err
	}

	erron := utils.Json.Get(res.Body(), "errno").ToInt()
	switch erron {
	case 0:
		break
	case 50805:
		return nil, fmt.Errorf("you have joined album")
	case 50820:
		return nil, fmt.Errorf("no shared albums found")
	case 50100:
		return nil, fmt.Errorf("illegal title, only supports 50 characters")
	// case -6:
	// 	if err = d.refreshToken(); err != nil {
	// 		return nil, err
	// 	}
	default:
		return nil, fmt.Errorf("errno: %d, refer to https://photo.baidu.com/union/doc", erron)
	}
	return res, nil
}

//func (d *BaiduPhoto) Request(furl string, method string, callback base.ReqCallback, resp interface{}) ([]byte, error) {
//	res, err := d.request(furl, method, callback, resp)
//	if err != nil {
//		return nil, err
//	}
//	return res.Body(), nil
//}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Validate/truncate the album title to <= 50 characters before CreateAlbum/SetAlbumName
  2. Strip emoji and unusual unicode from names before sending
  3. Surface a clear form-level error in the UI instead of the raw driver error

Example fix

// before
album, err := d.CreateAlbum(ctx, dirName) // dirName may be 200 chars

// after
name := []rune(dirName)
if len(name) > 50 {
    name = name[:50]
}
album, err := d.CreateAlbum(ctx, string(name))
Defensive patterns

Strategy: validation

Validate before calling

func validAlbumTitle(name string) bool {
    r := []rune(name)
    if len(r) == 0 || len(r) > 50 {
        return false
    }
    for _, c := range r {
        if c > 0xFFFF { // surrogate-range / exotic chars Baidu rejects
            return false
        }
    }
    return true
}

if !validAlbumTitle(dirName) {
    return fmt.Errorf("album name must be 1-50 safe characters")
}
d.CreateAlbum(ctx, dirName)

Prevention

When it happens

Trigger: Creating an album whose name exceeds 50 characters; renaming an album to a long name; album names containing emoji or characters outside the accepted set.

Common situations: Mapping arbitrary folder names from another storage backend onto Baidu Photo albums; long auto-generated names from sync jobs; user pasting a long string into the album name field.

Related errors


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