{"record":{"id":"af39c65a86868024","repo":"asdf-vm/asdf","slug":"failed-to-run-install-callback-w","errorCode":null,"errorMessage":"failed to run install callback: %w","messagePattern":"failed to run install callback: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/installtest/installtest.go","lineNumber":61,"sourceCode":"\n\terr = os.MkdirAll(downloadDir, 0o777)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to create download dir: %w\", err)\n\t}\n\n\terr = plugin.RunCallback(\"download\", []string{}, env, &stdOut, &stdErr)\n\tif _, ok := err.(plugins.NoCallbackError); err != nil && !ok {\n\t\treturn fmt.Errorf(\"failed to run download callback: %w\", err)\n\t}\n\n\terr = os.MkdirAll(installDir, 0o777)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to create install dir: %w\", err)\n\t}\n\n\terr = plugin.RunCallback(\"install\", []string{}, env, &stdOut, &stdErr)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to run install callback: %w\", err)\n\t}\n\n\treturn nil\n}\n\n// InstallPath returns the path to a tool installation\nfunc InstallPath(conf config.Config, plugin plugins.Plugin, version string) string {\n\treturn filepath.Join(pluginInstallPath(conf, plugin), formatVersionStringForFS(version))\n}\n\n// DownloadPath returns the download path for a particular plugin and version\nfunc DownloadPath(conf config.Config, plugin plugins.Plugin, version string) string {\n\treturn filepath.Join(conf.DataDir, dataDirDownloads, plugin.Name, formatVersionStringForFS(version))\n}\n\nfunc pluginInstallPath(conf config.Config, plugin plugins.Plugin) string {\n\treturn filepath.Join(conf.DataDir, dataDirInstalls, plugin.Name)\n}","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/asdf-vm/asdf/blob/074a1722ca88d6677f228541ce06efaf4f9924d4/internal/installtest/installtest.go#L43-L79","documentation":"InstallOneVersion runs the plugin's 'install' callback inside the install directory. Unlike the download callback, install is mandatory here: any error returned by RunCallback (including NoCallbackError) is wrapped as 'failed to run install callback'. A non-zero exit from the plugin's install script produces this error.","triggerScenarios":"Calling InstallOneVersion when: the plugin has no install callback (NoCallbackError is NOT tolerated); the install callback exits non-zero (build failure, missing system dependency, unsupported platform/OS branch in the script); the callback script cannot be executed.","commonSituations":"Installing a tool version that requires a build toolchain (make, cargo, python) absent from the machine; plugin script lacks a case branch for your OS/arch; downloading during install blocked by a proxy or firewall; corrupted or incomplete download from the previous step.","solutions":["Inspect the wrapped error plus the stdOut/stdErr captured during the run for the callback's real failure output.","Run the plugin's install callback manually in the install dir to see the underlying failure.","Install the missing system dependency or toolchain the callback needs.","Fix or report the plugin script bug (e.g. add your platform to its OS/arch switch)."],"exampleFix":"// plugin bin/install missing build tool\n# before\ncargo build --release\n# after\ntype cargo >/dev/null 2>&1 || { echo \"cargo is required\" >&2; exit 1; }\ncargo build --release","handlingStrategy":"try-catch","validationCode":"if fi, err := os.Stat(filepath.Join(pluginDir, \"bin\", \"install\")); err != nil || fi.IsDir() {\n    return fmt.Errorf(\"plugin %s has no install callback\", name)\n}\nif fi.Mode()&0o111 == 0 {\n    return fmt.Errorf(\"install callback not executable\")\n}","typeGuard":null,"tryCatchPattern":"err := installtest.InstallOneVersion(conf, plugin, version)\nif err != nil {\n    if strings.Contains(err.Error(), \"failed to run install callback\") {\n        // print captured stdOut/stdErr from the callback for the real cause\n        log.Fatalf(\"install callback failed: %v\", err)\n    }\n}","preventionTips":["Test plugins with `asdf plugin test` on all target OS/arch combinations.","Install required build toolchains in the environment before installing tools.","Make install callbacks fail loudly with messages to stderr.","Guard downloads in callbacks with curl --fail and explicit exit codes."],"tags":["plugin-callback","install","script"],"backgroundTag":"plugin-install-callback-failed","analyzedSha":"074a1722ca88d6677f228541ce06efaf4f9924d4","analyzedAt":"2026-08-30T19:56:42.972Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}