wavetermdev/waveterm · error

app '%s' does not exist in local or draft namespace

Error message

app '%s' does not exist in local or draft namespace

What it means

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.

Source

Thrown at pkg/waveappstore/waveappstore.go:683

	newDraftDir := filepath.Join(waveappsDir, AppNSDraft, newAppName)

	// Check if at least one of the apps exists
	localExists := false
	draftExists := false
	if _, err := os.Stat(oldLocalDir); err == nil {
		localExists = true
	} else if !os.IsNotExist(err) {
		return fmt.Errorf("failed to check local app: %w", err)
	}

	if _, err := os.Stat(oldDraftDir); err == nil {
		draftExists = true
	} else if !os.IsNotExist(err) {
		return fmt.Errorf("failed to check draft app: %w", err)
	}

	if !localExists && !draftExists {
		return fmt.Errorf("app '%s' does not exist in local or draft namespace", appName)
	}

	// Check if new app name already exists in either namespace
	if _, err := os.Stat(newLocalDir); err == nil {
		return fmt.Errorf("local app '%s' already exists", newAppName)
	} else if !os.IsNotExist(err) {
		return fmt.Errorf("failed to check if new local app exists: %w", err)
	}

	if _, err := os.Stat(newDraftDir); err == nil {
		return fmt.Errorf("draft app '%s' already exists", newAppName)
	} else if !os.IsNotExist(err) {
		return fmt.Errorf("failed to check if new draft app exists: %w", err)
	}

	// Rename local app if it exists
	if localExists {
		if err := os.Rename(oldLocalDir, newLocalDir); err != nil {

View on GitHub (pinned to a4447c1563)

Solutions

  1. Verify the app exists under ~/waveapps/local/ or ~/waveapps/draft/ before renaming
  2. Check for typos or case differences in appName
  3. If it was already renamed, use the new name or skip the rename

Example fix

// before
RenameLocalApp("oldname", "newname") // oldname never installed
// after
if exists, _ := waveappstore.LocalAppExists("oldname"); exists {
    RenameLocalApp("oldname", "newname")
}
Defensive patterns

Strategy: validation

Validate before calling

func appExists(name string) bool {
    home := wavebase.GetHomeDir()
    for _, ns := range []string{"local", "draft"} {
        if _, err := os.Stat(filepath.Join(home, "waveapps", ns, name)); err == nil { return true }
    }
    return false
}
// only call RenameLocalApp if appExists(oldName)

Try / catch

if err := waveappstore.RenameLocalApp(oldName, newName); err != nil {
    if strings.Contains(err.Error(), "does not exist in local or draft namespace") {
        // treat as idempotent no-op or report 'app not found'
        return nil
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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