{"record":{"id":"d02a0fde76050fad","repo":"wavetermdev/waveterm","slug":"failed-to-run-app-w","errorCode":null,"errorMessage":"failed to run app: %w","messagePattern":"failed to run app: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/buildercontroller/buildercontroller.go","lineNumber":266,"sourceCode":"\tif err != nil {\n\t\tbc.handleBuildError(fmt.Errorf(\"build failed: %w\", err), resultCh)\n\t\treturn\n\t}\n\n\tinfo, err := os.Stat(cachePath)\n\tif err != nil {\n\t\tbc.handleBuildError(fmt.Errorf(\"build output not found: %w\", err), resultCh)\n\t\treturn\n\t}\n\n\tif runtime.GOOS != \"windows\" && info.Mode()&0111 == 0 {\n\t\tbc.handleBuildError(fmt.Errorf(\"build output is not executable\"), resultCh)\n\t\treturn\n\t}\n\n\tprocess, err := bc.runBuilderApp(ctx, appId, cachePath, builderEnv)\n\tif err != nil {\n\t\tbc.handleBuildError(fmt.Errorf(\"failed to run app: %w\", err), resultCh)\n\t\treturn\n\t}\n\n\tbc.lock.Lock()\n\tbc.process = process\n\tbc.setStatus_nolock(BuilderStatus_Running, process.Port, 0, \"\")\n\tbc.lock.Unlock()\n\n\ttime.Sleep(1 * time.Second)\n\n\tif resultCh != nil {\n\t\tbuildOutput := \"\"\n\t\tif bc.outputBuffer != nil {\n\t\t\tlines := bc.outputBuffer.GetLines()\n\t\t\tbuildOutput = strings.Join(lines, \"\\n\")\n\t\t}\n\t\tselect {\n\t\tcase resultCh <- &BuildResult{","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/buildercontroller/buildercontroller.go#L248-L284","documentation":"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).","triggerScenarios":"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).","commonSituations":"App manifest deleted after build; secrets not provisioned for the app namespace; binary built for wrong GOARCH; firewall/port conflicts; broken builderEnv.","solutions":["Inspect the wrapped inner error for the actual failing step (manifest, secrets, port, exec)","Verify the app manifest (app.json) exists and is valid in the app dir","Confirm secret bindings are provisioned for the app (see ERR-SECRET errors)","Ensure the binary matches the host OS/arch and required libs are present"],"exampleFix":"// before\nprocess, err := bc.runBuilderApp(ctx, appId, cachePath, builderEnv) // manifest missing\n// after\nif _, err := waveappstore.ReadAppManifest(appId); err != nil {\n    // surface a precise message / reinstall app before attempting to run\n}","handlingStrategy":"try-catch","validationCode":"if _, err := waveappstore.ReadAppManifest(appId); err != nil { return err }","typeGuard":null,"tryCatchPattern":"if err := runBuild(appId); err != nil {\n    if strings.Contains(err.Error(), \"failed to run app\") {\n        log.Printf(\"launch failure detail: %v\", err) // unwrap inner cause\n    }\n}","preventionTips":["Verify manifest + secrets exist before launch","Match build GOARCH to host architecture","Free/reserve ports for the builder process"],"tags":["go","process","builder"],"backgroundTag":"app-launch-failed","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}