wavetermdev/waveterm · error

failed to run app: %w

Error message

failed to run app: %w

What it means

The controller wraps any error returned by bc.runBuilderApp(ctx, appId, cachePath, builderEnv) as "failed to run app". runBuilderApp reads manifest/secret data, validates the binary, and launches the process; a failure at any of those steps surfaces here (manifest missing, port allocation failure, exec failure).

Source

Thrown at pkg/buildercontroller/buildercontroller.go:266

	if err != nil {
		bc.handleBuildError(fmt.Errorf("build failed: %w", err), resultCh)
		return
	}

	info, err := os.Stat(cachePath)
	if err != nil {
		bc.handleBuildError(fmt.Errorf("build output not found: %w", err), resultCh)
		return
	}

	if runtime.GOOS != "windows" && info.Mode()&0111 == 0 {
		bc.handleBuildError(fmt.Errorf("build output is not executable"), resultCh)
		return
	}

	process, err := bc.runBuilderApp(ctx, appId, cachePath, builderEnv)
	if err != nil {
		bc.handleBuildError(fmt.Errorf("failed to run app: %w", err), resultCh)
		return
	}

	bc.lock.Lock()
	bc.process = process
	bc.setStatus_nolock(BuilderStatus_Running, process.Port, 0, "")
	bc.lock.Unlock()

	time.Sleep(1 * time.Second)

	if resultCh != nil {
		buildOutput := ""
		if bc.outputBuffer != nil {
			lines := bc.outputBuffer.GetLines()
			buildOutput = strings.Join(lines, "\n")
		}
		select {
		case resultCh <- &BuildResult{

View on GitHub (pinned to a4447c1563)

Solutions

  1. Inspect the wrapped inner error for the actual failing step (manifest, secrets, port, exec)
  2. Verify the app manifest (app.json) exists and is valid in the app dir
  3. Confirm secret bindings are provisioned for the app (see ERR-SECRET errors)
  4. Ensure the binary matches the host OS/arch and required libs are present

Example fix

// before
process, err := bc.runBuilderApp(ctx, appId, cachePath, builderEnv) // manifest missing
// after
if _, err := waveappstore.ReadAppManifest(appId); err != nil {
    // surface a precise message / reinstall app before attempting to run
}
Defensive patterns

Strategy: try-catch

Validate before calling

if _, err := waveappstore.ReadAppManifest(appId); err != nil { return err }

Try / catch

if err := runBuild(appId); err != nil {
    if strings.Contains(err.Error(), "failed to run app") {
        log.Printf("launch failure detail: %v", err) // unwrap inner cause
    }
}

Prevention

When it happens

Trigger: runBuilderApp returns error — unreadable app manifest, unreadable/undecryptable secret bindings, secret env build failure, port allocation failure, or the binary failing to exec (arch mismatch, missing interpreter).

Common situations: App manifest deleted after build; secrets not provisioned for the app namespace; binary built for wrong GOARCH; firewall/port conflicts; broken builderEnv.

Related errors


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