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

  1. Shorten the namespace to 30 characters or fewer (count the '@' prefix toward the length).
  2. Use a compact abbreviation or handle for the namespace instead of a full domain/email.
  3. Rename/re-publish the app under a compliant namespace.
  4. 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

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


AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01). Data as JSON: /api/errors/b29dbd43405114eb. Report an issue: GitHub.