{"record":{"id":"724ac7b3df79608b","repo":"wavetermdev/waveterm","slug":"app-s-does-not-exist-in-local-or-draft-namespac","errorCode":null,"errorMessage":"app '%s' does not exist in local or draft namespace","messagePattern":"app '(.+?)' does not exist in local or draft namespace","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/waveappstore/waveappstore.go","lineNumber":683,"sourceCode":"\tnewDraftDir := filepath.Join(waveappsDir, AppNSDraft, newAppName)\n\n\t// Check if at least one of the apps exists\n\tlocalExists := false\n\tdraftExists := false\n\tif _, err := os.Stat(oldLocalDir); err == nil {\n\t\tlocalExists = true\n\t} else if !os.IsNotExist(err) {\n\t\treturn fmt.Errorf(\"failed to check local app: %w\", err)\n\t}\n\n\tif _, err := os.Stat(oldDraftDir); err == nil {\n\t\tdraftExists = true\n\t} else if !os.IsNotExist(err) {\n\t\treturn fmt.Errorf(\"failed to check draft app: %w\", err)\n\t}\n\n\tif !localExists && !draftExists {\n\t\treturn fmt.Errorf(\"app '%s' does not exist in local or draft namespace\", appName)\n\t}\n\n\t// Check if new app name already exists in either namespace\n\tif _, err := os.Stat(newLocalDir); err == nil {\n\t\treturn fmt.Errorf(\"local app '%s' already exists\", newAppName)\n\t} else if !os.IsNotExist(err) {\n\t\treturn fmt.Errorf(\"failed to check if new local app exists: %w\", err)\n\t}\n\n\tif _, err := os.Stat(newDraftDir); err == nil {\n\t\treturn fmt.Errorf(\"draft app '%s' already exists\", newAppName)\n\t} else if !os.IsNotExist(err) {\n\t\treturn fmt.Errorf(\"failed to check if new draft app exists: %w\", err)\n\t}\n\n\t// Rename local app if it exists\n\tif localExists {\n\t\tif err := os.Rename(oldLocalDir, newLocalDir); err != nil {","sourceCodeStart":665,"sourceCodeEnd":701,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/waveappstore/waveappstore.go#L665-L701","documentation":"RenameLocalApp requires the source app to exist in at least one namespace (local or draft). If neither old directory exists, it refuses with \"app '%s' does not exist in local or draft namespace\" rather than renaming nothing.","triggerScenarios":"Calling RenameLocalApp with an appName that has no directory under either ~/waveapps/local/<name> or ~/waveapps/draft/<name> — e.g. the app was already renamed/deleted, or the name is misspelled.","commonSituations":"Renaming an app twice (second call uses the old name), deleting the app before renaming, typos in the name, or a case-mismatch in the name.","solutions":["Verify the app exists under ~/waveapps/local/ or ~/waveapps/draft/ before renaming","Check for typos or case differences in appName","If it was already renamed, use the new name or skip the rename"],"exampleFix":"// before\nRenameLocalApp(\"oldname\", \"newname\") // oldname never installed\n// after\nif exists, _ := waveappstore.LocalAppExists(\"oldname\"); exists {\n    RenameLocalApp(\"oldname\", \"newname\")\n}","handlingStrategy":"validation","validationCode":"func appExists(name string) bool {\n    home := wavebase.GetHomeDir()\n    for _, ns := range []string{\"local\", \"draft\"} {\n        if _, err := os.Stat(filepath.Join(home, \"waveapps\", ns, name)); err == nil { return true }\n    }\n    return false\n}\n// only call RenameLocalApp if appExists(oldName)","typeGuard":null,"tryCatchPattern":"if err := waveappstore.RenameLocalApp(oldName, newName); err != nil {\n    if strings.Contains(err.Error(), \"does not exist in local or draft namespace\") {\n        // treat as idempotent no-op or report 'app not found'\n        return nil\n    }\n    return err\n}","preventionTips":["Confirm the app is installed/drafted before renaming","Track prior renames so you never reuse the old name after a successful move","Check for typos and exact casing in the app name"],"tags":["go","rename","not-found","waveappstore"],"backgroundTag":"app-not-found","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}