wavetermdev/waveterm · error
namespace too long: max %d characters
Error message
namespace too long: max %d characters
What it means
ValidateAppId enforces MaxNamespaceLen (30 characters) on the namespace segment of an appId so it can be used as a filesystem directory name without path-length problems. This error means the namespace segment (before the '/', optionally prefixed with '@') exceeds 30 bytes.
Source
Thrown at pkg/waveappstore/waveappstore.go:66
parts := strings.Split(appId, "/")
if len(parts) != 2 {
return "", "", fmt.Errorf("invalid appId format: must be namespace/name")
}
appNS = parts[0]
appName = parts[1]
if appNS == "" || appName == "" {
return "", "", fmt.Errorf("invalid appId: namespace and name cannot be empty")
}
return appNS, appName, nil
}
func ValidateAppId(appId string) error {
appNS, appName, err := ParseAppId(appId)
if err != nil {
return err
}
if len(appNS) > MaxNamespaceLen {
return fmt.Errorf("namespace too long: max %d characters", MaxNamespaceLen)
}
if len(appName) > MaxAppNameLen {
return fmt.Errorf("app name too long: max %d characters", MaxAppNameLen)
}
if !namespaceRegex.MatchString(appNS) {
return fmt.Errorf("invalid namespace: must match pattern @?[a-z0-9-]+")
}
if !appNameRegex.MatchString(appName) {
return fmt.Errorf("invalid app name: must match pattern [a-zA-Z0-9_-]+")
}
return nil
}
func GetAppDir(appId string) (string, error) {
if err := ValidateAppId(appId); err != nil {
return "", err
}
appNS, appName, _ := ParseAppId(appId)View on GitHub (pinned to a4447c1563)
Solutions
- Shorten the namespace to 30 characters or fewer (count the '@' prefix toward the length).
- Use a compact abbreviation or handle for the namespace instead of a full domain/email.
- Rename/re-publish the app under a compliant namespace.
- Pre-validate with len(ns) <= waveappstore.MaxNamespaceLen in UI/CLI input fields before constructing the id.
Example fix
// before appId := "@my-very-long-organization-team-name/myapp" // ns is 33 chars -> too long err := waveappstore.PublishDraft(appId, dir) // after appId := "@my-org/myapp" // ns is 7 chars, within MaxNamespaceLen (30) err := waveappstore.PublishDraft(appId, dir)
Defensive patterns
Strategy: validation
Validate before calling
func nsLenOK(appId string) bool {
ns, _, err := waveappstore.ParseAppId(appId)
return err == nil && len(ns) <= waveappstore.MaxNamespaceLen
}
if !nsLenOK(appId) { /* shorten the namespace first */ } Type guard
func namespaceWithinLimit(appId string, max int) bool {
ns, _, err := waveappstore.ParseAppId(appId)
return err == nil && len(ns) <= max
} Try / catch
if err := waveappstore.ValidateAppId(appId); err != nil {
var maxLen int
if _, scan := fmt.Sscanf(err.Error(), "namespace too long: max %d", &maxLen); scan == nil {
return fmt.Errorf("namespace exceeds %d chars; abbreviate it", maxLen)
}
return err
} Prevention
- Cap namespace input fields at waveappstore.MaxNamespaceLen (30) including the '@'.
- Derive namespaces from handles/org slugs, not full domains or emails.
- Truncate + disambiguate generated namespaces before composing ids.
- Run ValidateAppId before any store operation (publish, delete, write).
When it happens
Trigger: Calling ValidateAppId (directly or via GetAppDir, PublishDraft, RevertDraft, MakeDraftFromLocal, DeleteApp, WriteAppId paths like DeleteApp/WriteAppFile) with an appId whose namespace, e.g. "@very-long-organization-team-name/app", exceeds 30 characters.
Common situations: Using a full domain or long GitHub org name as the namespace; generating namespaces from long email addresses or team names; migrating apps published under a namespace scheme longer than the current limit.
Related errors
- app name too long: max %d characters
- invalid appId format: must be namespace/name
- invalid appId: namespace and name cannot be empty
- invalid AIMessage: %w
- part %d: text type requires non-empty text field
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/b29dbd43405114eb.
Report an issue: GitHub.