{"record":{"id":"80b07ff871f27567","repo":"wavetermdev/waveterm","slug":"app-name-too-long-max-d-characters","errorCode":null,"errorMessage":"app name too long: max %d characters","messagePattern":"app name too long: max (.+?) characters","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/waveappstore/waveappstore.go","lineNumber":69,"sourceCode":"\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)\n\thomeDir := wavebase.GetHomeDir()\n\treturn filepath.Join(homeDir, \"waveapps\", appNS, appName), nil\n}","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/waveappstore/waveappstore.go#L51-L87","documentation":"ValidateAppId enforces MaxAppNameLen (50 characters) on the app name segment of an appId. This error means the name after the '/' is longer than 50 bytes, which could break on-disk paths and manifest consistency.","triggerScenarios":"Calling ValidateAppId (or GetAppDir, PublishDraft, RevertDraft, MakeDraftFromLocal, DeleteApp, WriteAppFile) with an appId like \"local/a-very-long-descriptive-application-name-exceeding-fifty-chars\" where the name segment exceeds 50 characters.","commonSituations":"Auto-generating app names from long titles, URLs, or package names without truncation; concatenating suffixes (\"-draft\", \"-copy\") onto names already near the limit; importing apps named under looser external schemes.","solutions":["Shorten the app name to 50 characters or fewer.","Truncate or slugify generated names before composing the appId.","Re-publish the app under a shorter name and update references.","Pre-validate with len(name) <= waveappstore.MaxAppNameLen in form/CLI inputs."],"exampleFix":"// before\nname := \"my-super-descriptive-wave-application-project-final\"\nappId := waveappstore.MakeAppId(\"local\", name) // name is 52 chars -> too long\n// after\nname := \"my-super-descriptive-wave-application\" // <= 50 chars\nappId := waveappstore.MakeAppId(\"local\", name)","handlingStrategy":"validation","validationCode":"func nameLenOK(appId string) bool {\n    _, name, err := waveappstore.ParseAppId(appId)\n    return err == nil && len(name) <= waveappstore.MaxAppNameLen\n}\nif !nameLenOK(appId) { /* shorten the app name first */ }","typeGuard":"func appNameWithinLimit(appId string, max int) bool {\n    _, name, err := waveappstore.ParseAppId(appId)\n    return err == nil && len(name) <= max\n}","tryCatchPattern":"if err := waveappstore.ValidateAppId(appId); err != nil {\n    var maxLen int\n    if _, scan := fmt.Sscanf(err.Error(), \"app name too long: max %d\", &maxLen); scan == nil {\n        return fmt.Errorf(\"app name exceeds %d chars; shorten or slugify it\", maxLen)\n    }\n    return err\n}","preventionTips":["Cap app-name input fields at waveappstore.MaxAppNameLen (50).","Slugify names generated from titles or URLs and truncate before use.","Watch suffix appends (\"-draft\", \"-copy\") that push names past the limit.","Validate early at the CLI/UI boundary before calling store APIs."],"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"}