{"record":{"id":"0f7c5a6684e98fe0","repo":"wavetermdev/waveterm","slug":"failed-to-create-app-bin-directory-w","errorCode":null,"errorMessage":"failed to create app bin directory: %w","messagePattern":"failed to create app bin directory: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/buildercontroller/buildercontroller.go","lineNumber":120,"sourceCode":"\tmapLock.Unlock()\n\n\tif bc != nil {\n\t\tbc.Stop()\n\t}\n}\n\nfunc GetBuilderAppExecutablePath(appPath string) (string, error) {\n\tbinDir := filepath.Join(appPath, \"bin\")\n\n\tbinaryName := \"app\"\n\tif runtime.GOOS == \"windows\" {\n\t\tbinaryName = \"app.exe\"\n\t}\n\tbinPath := filepath.Join(binDir, binaryName)\n\n\terr := wavebase.TryMkdirs(binDir, 0755, \"app bin directory\")\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to create app bin directory: %w\", err)\n\t}\n\n\treturn binPath, nil\n}\n\nfunc Shutdown() {\n\tmapLock.Lock()\n\tcontrollers := make([]*BuilderController, 0, len(controllerMap))\n\tfor _, bc := range controllerMap {\n\t\tcontrollers = append(controllers, bc)\n\t}\n\tmapLock.Unlock()\n\n\tfor _, bc := range controllers {\n\t\tbc.Stop()\n\t}\n}\n","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/buildercontroller/buildercontroller.go#L102-L138","documentation":"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.","triggerScenarios":"buildAndRun → GetBuilderAppExecutablePath; mkdir fails due to permissions, read-only filesystem, or path is a file, or disk full.","commonSituations":"App cache dir owned by another user; disk quota exceeded; ~/.waveterm cache path on a read-only mount.","solutions":["Check the wrapped %w cause (EACCES/ENOSPC/ENOTDIR)","Fix permissions on the app cache base directory","Free disk space or address quota limits","Remove a non-directory file occupying the bin dir path"],"exampleFix":"// before\nerr := wavebase.TryMkdirs(binDir, 0755, \"app bin directory\")\n// after\nif err := wavebase.TryMkdirs(binDir, 0755, \"app bin directory\"); err != nil {\n\tos.MkdirAll(filepath.Dir(binDir), 0755) // repair parent chain first\n\treturn \"\", fmt.Errorf(\"failed to create app bin directory: %w\", err)\n}","handlingStrategy":"validation","validationCode":"if st, err := os.Stat(filepath.Dir(binDir)); err != nil || !st.IsDir() {\n\t// fix base dir before building\n}","typeGuard":null,"tryCatchPattern":"binPath, err := GetBuilderAppExecutablePath(appPath)\nif err != nil && strings.Contains(err.Error(), \"failed to create app bin directory\") {\n\t// check permissions/disk and retry\n}","preventionTips":["Ensure the app cache root is writable by the running user","Watch free disk space before builds","Never place files where the bin dir will be created"],"tags":["filesystem","mkdir","permissions"],"backgroundTag":"mkdir-failed","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}