{"record":{"id":"b29dbd43405114eb","repo":"wavetermdev/waveterm","slug":"namespace-too-long-max-d-characters","errorCode":null,"errorMessage":"namespace too long: max %d characters","messagePattern":"namespace too long: max (.+?) characters","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/waveappstore/waveappstore.go","lineNumber":66,"sourceCode":"\tparts := strings.Split(appId, \"/\")\n\tif len(parts) != 2 {\n\t\treturn \"\", \"\", fmt.Errorf(\"invalid appId format: must be namespace/name\")\n\t}\n\tappNS = parts[0]\n\tappName = parts[1]\n\tif appNS == \"\" || appName == \"\" {\n\t\treturn \"\", \"\", fmt.Errorf(\"invalid appId: namespace and name cannot be empty\")\n\t}\n\treturn appNS, appName, nil\n}\n\nfunc ValidateAppId(appId string) error {\n\tappNS, appName, err := ParseAppId(appId)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(appNS) > MaxNamespaceLen {\n\t\treturn fmt.Errorf(\"namespace too long: max %d characters\", MaxNamespaceLen)\n\t}\n\tif len(appName) > MaxAppNameLen {\n\t\treturn fmt.Errorf(\"app name too long: max %d characters\", MaxAppNameLen)\n\t}\n\tif !namespaceRegex.MatchString(appNS) {\n\t\treturn fmt.Errorf(\"invalid namespace: must match pattern @?[a-z0-9-]+\")\n\t}\n\tif !appNameRegex.MatchString(appName) {\n\t\treturn fmt.Errorf(\"invalid app name: must match pattern [a-zA-Z0-9_-]+\")\n\t}\n\treturn nil\n}\n\nfunc GetAppDir(appId string) (string, error) {\n\tif err := ValidateAppId(appId); err != nil {\n\t\treturn \"\", err\n\t}\n\tappNS, appName, _ := ParseAppId(appId)","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/waveappstore/waveappstore.go#L48-L84","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nappId := \"@my-very-long-organization-team-name/myapp\" // ns is 33 chars -> too long\nerr := waveappstore.PublishDraft(appId, dir)\n// after\nappId := \"@my-org/myapp\" // ns is 7 chars, within MaxNamespaceLen (30)\nerr := waveappstore.PublishDraft(appId, dir)","handlingStrategy":"validation","validationCode":"func nsLenOK(appId string) bool {\n    ns, _, err := waveappstore.ParseAppId(appId)\n    return err == nil && len(ns) <= waveappstore.MaxNamespaceLen\n}\nif !nsLenOK(appId) { /* shorten the namespace first */ }","typeGuard":"func namespaceWithinLimit(appId string, max int) bool {\n    ns, _, err := waveappstore.ParseAppId(appId)\n    return err == nil && len(ns) <= max\n}","tryCatchPattern":"if err := waveappstore.ValidateAppId(appId); err != nil {\n    var maxLen int\n    if _, scan := fmt.Sscanf(err.Error(), \"namespace too long: max %d\", &maxLen); scan == nil {\n        return fmt.Errorf(\"namespace exceeds %d chars; abbreviate it\", maxLen)\n    }\n    return err\n}","preventionTips":["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)."],"tags":["go","validation","length-limit","waveapp"],"backgroundTag":"identifier-too-long","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}