wavetermdev/waveterm · error

failed to create app bin directory: %w

Error message

failed to create app bin directory: %w

What it means

GetBuilderAppExecutablePath could not create the directory where the built app binary will be placed (wavebase.TryMkdirs failed), so the build output path cannot be prepared. It wraps the underlying mkdir error with %w.

Source

Thrown at pkg/buildercontroller/buildercontroller.go:120

	mapLock.Unlock()

	if bc != nil {
		bc.Stop()
	}
}

func GetBuilderAppExecutablePath(appPath string) (string, error) {
	binDir := filepath.Join(appPath, "bin")

	binaryName := "app"
	if runtime.GOOS == "windows" {
		binaryName = "app.exe"
	}
	binPath := filepath.Join(binDir, binaryName)

	err := wavebase.TryMkdirs(binDir, 0755, "app bin directory")
	if err != nil {
		return "", fmt.Errorf("failed to create app bin directory: %w", err)
	}

	return binPath, nil
}

func Shutdown() {
	mapLock.Lock()
	controllers := make([]*BuilderController, 0, len(controllerMap))
	for _, bc := range controllerMap {
		controllers = append(controllers, bc)
	}
	mapLock.Unlock()

	for _, bc := range controllers {
		bc.Stop()
	}
}

View on GitHub (pinned to a4447c1563)

Solutions

  1. Check the wrapped %w cause (EACCES/ENOSPC/ENOTDIR)
  2. Fix permissions on the app cache base directory
  3. Free disk space or address quota limits
  4. Remove a non-directory file occupying the bin dir path

Example fix

// before
err := wavebase.TryMkdirs(binDir, 0755, "app bin directory")
// after
if err := wavebase.TryMkdirs(binDir, 0755, "app bin directory"); err != nil {
	os.MkdirAll(filepath.Dir(binDir), 0755) // repair parent chain first
	return "", fmt.Errorf("failed to create app bin directory: %w", err)
}
Defensive patterns

Strategy: validation

Validate before calling

if st, err := os.Stat(filepath.Dir(binDir)); err != nil || !st.IsDir() {
	// fix base dir before building
}

Try / catch

binPath, err := GetBuilderAppExecutablePath(appPath)
if err != nil && strings.Contains(err.Error(), "failed to create app bin directory") {
	// check permissions/disk and retry
}

Prevention

When it happens

Trigger: buildAndRun → GetBuilderAppExecutablePath; mkdir fails due to permissions, read-only filesystem, or path is a file, or disk full.

Common situations: App cache dir owned by another user; disk quota exceeded; ~/.waveterm cache path on a read-only mount.

Related errors


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