AlistGo/alist · error

tld %s is not supported

Error message

tld %s is not supported

What it means

The odrvcookie WebDAV driver maps a SharePoint endpoint's top-level domain to a Microsoft login URL via a fixed map (com, cn, de, us...). When the endpoint's TLD is not a key in loginUrlsMap, getLoginUrl refuses with 'tld %s is not supported' because no extSTS.srf auth endpoint exists for that cloud.

Source

Thrown at drivers/webdav/odrvcookie/fetch.go:158

}

var loginUrlsMap = map[string]string{
	"com": "https://login.microsoftonline.com",
	"cn":  "https://login.chinacloudapi.cn",
	"us":  "https://login.microsoftonline.us",
	"de":  "https://login.microsoftonline.de",
}

func getLoginUrl(endpoint string) (string, error) {
	spRoot, err := url.Parse(endpoint)
	if err != nil {
		return "", err
	}
	domains := strings.Split(spRoot.Host, ".")
	tld := domains[len(domains)-1]
	loginUrl, ok := loginUrlsMap[tld]
	if !ok {
		return "", fmt.Errorf("tld %s is not supported", tld)
	}
	return loginUrl + "/extSTS.srf", nil
}

func (ca *CookieAuth) getSPToken() (*SuccessResponse, error) {
	loginUrl, err := getLoginUrl(ca.endpoint)
	if err != nil {
		return nil, err
	}
	reqData := map[string]string{
		"Username": ca.user,
		"Password": ca.pass,
		"Address":  ca.endpoint,
		"LoginUrl": loginUrl,
	}

	t := template.Must(template.New("authXML").Parse(reqString))

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Use an endpoint on a supported TLD: sharepoint.com (global), sharepoint.cn (21Vianet), login.microsoftonline.de / .us variants per the map.
  2. If you control the deployment, add the missing TLD->loginUrl mapping to loginUrlsMap in drivers/webdav/odrvcookie/fetch.go and rebuild.
  3. Switch the storage to the standard onedrive/webdav driver if the sovereign cloud is unsupported.

Example fix

// extend the map for a private cloud (drivers/webdav/odrvcookie/fetch.go)
var loginUrlsMap = map[string]string{
  "com": "https://login.microsoftonline.com",
  "cn": "https://login.chinacloudapi.cn",
  // add:
  "fr": "https://login.microsoftonline.fr",
}
Defensive patterns

Strategy: validation

Validate before calling

var supportedTLDs = map[string]bool{"com": true, "cn": true, "de": true, "us": true}
func endpointSupported(endpoint string) bool {
    u, err := url.Parse(endpoint)
    if err != nil { return false }
    parts := strings.Split(u.Host, ".")
    return supportedTLDs[parts[len(parts)-1]]
}

Try / catch

if _, err := ca.getSPToken(); err != nil && strings.Contains(err.Error(), "tld") && strings.Contains(err.Error(), "not supported") {
    // switch endpoint to a supported sovereign cloud or extend loginUrlsMap
}

Prevention

When it happens

Trigger: CookieAuth.getSPToken parsing the configured SharePoint endpoint and finding a TLD outside the map — e.g. endpoints on .fr, .edu, or any custom/government cloud domain not listed.

Common situations: Using SharePoint Online in a national/sovereign cloud beyond the supported set, or pointing the endpoint at a custom vanity domain whose last label isn't in the map.

Related errors


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