siyuan-note/siyuan · error
invalid package name: %s
Error message
invalid package name: %s
What it means
Error returned by model.GetInstalledBazaarPackageRatings (kernel/model/bazaar_rating.go:84) when any entry of packageNames fails bazaar.IsValidPackageName. That validator enforces a cross-platform-safe directory name: length 1..255, printable ASCII only (0x20..0x7E), no chars from `<>&'":/\|?*`, no leading/trailing dot or space, no ".." substring, and none of the Windows reserved device names (CON, PRN, AUX, NUL, COM1-9, LPT1-9, case-insensitive).
Source
Thrown at kernel/model/bazaar_rating.go:84
return nil, nil, errors.New("invalid package type")
}
installedInfos, _, _, err := bazaarRatingInstalledPackageInfos(pkgType)
if nil != err {
return nil, nil, err
}
installed := make(map[string]bool, len(installedInfos))
for _, info := range installedInfos {
if "" == info.Pkg.InvalidReason {
installed[info.Pkg.Name] = true
}
}
names := make([]string, 0, len(packageNames))
seen := make(map[string]bool, len(packageNames))
for _, packageName := range packageNames {
if !bazaar.IsValidPackageName(packageName) {
return nil, nil, fmt.Errorf("invalid package name: %s", packageName)
}
if !installed[packageName] || seen[packageName] {
continue
}
seen[packageName] = true
names = append(names, packageName)
}
if 0 == len(names) {
return map[string]*bazaar.PackageRating{}, []string{}, nil
}
eligiblePackageNames, err = bazaarRatingExistingPackageNames(ctx, pkgType, names)
if nil != err {
return nil, nil, err
}
if 0 == len(eligiblePackageNames) {
return map[string]*bazaar.PackageRating{}, eligiblePackageNames, nil
}View on GitHub (pinned to afa823b6b4)
Solutions
- Use the exact package identifier from the installed manifest (info.Pkg.Name), which was itself validated at install time
- Filter each name through bazaar.IsValidPackageName before building the request
- Strip whitespace and reject non-ASCII input at the UI layer
Example fix
// before
ratings, eligible, err := model.GetInstalledBazaarPackageRatings(ctx, pkgType, names) // names from free text
// after
for _, n := range names {
if !bazaar.IsValidPackageName(n) {
return fmt.Errorf("skip invalid package name %q", n)
}
}
ratings, eligible, err := model.GetInstalledBazaarPackageRatings(ctx, pkgType, names) Defensive patterns
Strategy: validation
Validate before calling
filtered := names[:0]
for _, n := range names {
if bazaar.IsValidPackageName(n) {
filtered = append(filtered, n)
}
}
names = filtered Type guard
func isValidName(n string) bool { return bazaar.IsValidPackageName(n) } Prevention
- Only pass identifiers obtained from installed manifest data
- Remember the rules: printable ASCII, no path/shell metacharacters, no Windows device names, no leading/trailing dot or space
When it happens
Trigger: Passing a package name containing CJK characters, spaces, slashes, quotes, or a reserved device name in packageNames to /api/bazaar/getInstalledBazaarPackageRatings; a client forwarding free-text search input as a package name list.
Common situations: Display names (e.g. "Dark Theme (Pro)") confused with package identifiers; names pasted with trailing whitespace; non-ASCII project names from non-English authors used where the ASCII identifier is required.
Related errors
- invalid package type
- rating must be an integer from 0 to 5
- bazaarRatingRateLimited
- marketplace package ratings are unavailable
- invalid user rating returned by cloud server
AI-assisted analysis of siyuan-note/siyuan@afa823b6b4 (2026-08-18).
Data as JSON: /api/errors/2a97eefbb5ae36cc.
Report an issue: GitHub.