AlistGo/alist · error

make dir failed: %s

Error message

make dir failed: %s

What it means

GuangYaPan (光雅盘) MakeDir error: the create_dir endpoint answered HTTP-success but its msg field was not 'success' (case-insensitive), so the driver reports 'make dir failed: <backend msg>'. The backend returns Chinese-language or code-style messages describing why directory creation was rejected.

Source

Thrown at drivers/guangyapan/driver.go:261

		return err
	}

	name := strings.TrimSpace(dirName)
	if name == "" {
		return errors.New("dir name is empty")
	}

	parentID := parentDir.GetID()

	var out createDirResp
	if err := d.postAPI(ctx, "/nd.bizuserres.s/v1/file/create_dir", map[string]any{
		"parentId": parentID,
		"dirName":  name,
	}, &out); err != nil {
		return err
	}
	if !strings.EqualFold(strings.TrimSpace(out.Msg), "success") {
		return fmt.Errorf("make dir failed: %s", strings.TrimSpace(out.Msg))
	}
	return nil
}

func (d *GuangYaPan) Rename(ctx context.Context, srcObj model.Obj, newName string) error {
	if err := d.ensureAccessToken(ctx); err != nil {
		return err
	}

	fileID := strings.TrimSpace(srcObj.GetID())
	if fileID == "" {
		return errors.New("file id is empty")
	}
	name := strings.TrimSpace(newName)
	if name == "" {
		return errors.New("new name is empty")
	}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Read the backend msg in the error text — it names the exact rejection reason
  2. Check whether a folder with the same name already exists at the destination and rename if so
  3. Sanitize folder names (remove forbidden punctuation/emoji) before creating
  4. Refresh the parent listing to confirm parentID is a live directory
Defensive patterns

Strategy: try-catch

Validate before calling

func safeDirName(name string) bool {
  trimmed := strings.TrimSpace(name)
  return trimmed != "" && !strings.ContainsAny(trimmed, "\\/:*?\"<>|")
}

Try / catch

err := d.MakeDir(ctx, parentDir, name)
if err != nil {
  if strings.HasPrefix(err.Error(), "make dir failed") {
    // parse backend msg; on duplicate-exists treat as success for idempotency
  }
}

Prevention

When it happens

Trigger: Calling MakeDir where /nd.bizuserres.s/v1/file/create_dir rejects the request: duplicate directory name, invalid characters in dirName, parent ID not a folder, or account-level restrictions — postAPI succeeds but msg != success.

Common situations: Creating a folder that already exists at the same level; names with characters the backend forbids; parent folder ID from a stale cache; account out of folder quota or not entitled to create folders.

Related errors


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