asdf-vm/asdf · error
unable to check if plugin exists: %w
Error message
unable to check if plugin exists: %w
What it means
Remove first calls PluginExists, which stats the plugin's directory under the data dir. If that stat fails with an error other than ErrNotExist (e.g. a permission problem on a parent directory), the error is wrapped with this message rather than treated as 'not installed'. It distinguishes 'could not inspect' from 'definitely missing'.
Source
Thrown at internal/plugins/plugins.go:439
// Run post hooks
hook.Run(config, "post_asdf_plugin_add", []string{plugin.Name})
hook.Run(config, fmt.Sprintf("post_asdf_plugin_add_%s", plugin.Name), []string{})
return nil
}
// Remove uninstalls a plugin by removing it from the file system if installed
func Remove(config config.Config, pluginName string, stdout, stderr io.Writer) error {
err := validatePluginName(pluginName)
if err != nil {
return err
}
plugin := New(config, pluginName)
exists, err := PluginExists(config.DataDir, pluginName)
if err != nil {
return fmt.Errorf("unable to check if plugin exists: %w", err)
}
if !exists {
return fmt.Errorf("No such plugin: %s", pluginName)
}
hook.Run(config, "pre_asdf_plugin_remove", []string{plugin.Name})
hook.Run(config, fmt.Sprintf("pre_asdf_plugin_remove_%s", plugin.Name), []string{})
env := map[string]string{
"ASDF_PLUGIN_PATH": plugin.Dir,
"ASDF_PLUGIN_SOURCE_URL": plugin.URL,
}
plugin.RunCallback("pre-plugin-remove", []string{}, env, stdout, stderr)
pluginDir := data.PluginDirectory(config.DataDir, pluginName)
downloadDir := data.DownloadDirectory(config.DataDir, pluginName)
installDir := data.InstallDirectory(config.DataDir, pluginName)View on GitHub (pinned to 074a1722ca)
Solutions
- Check permissions on ASDF_DATA_DIR (~/.asdf) and its plugins/ directory; fix with chmod/chown
- Verify ASDF_DATA_DIR points to a real, accessible directory
- Retry the remove after fixing filesystem access
Defensive patterns
Strategy: validation
Validate before calling
info, err := os.Stat(data.PluginDirectory(dataDir, name))
if err != nil && !errors.Is(err, fs.ErrNotExist) {
return fmt.Errorf("cannot inspect plugin dir: %w", err)
} Try / catch
if err != nil && strings.Contains(err.Error(), "unable to check if plugin exists") {
// handle filesystem access problem before retrying Remove
} Prevention
- Keep ASDF_DATA_DIR readable by the user running asdf
- Avoid running asdf with mismatched user identities on shared data dirs
When it happens
Trigger: plugins.Remove when the os.Stat on data.PluginDirectory(dataDir, pluginName) fails with a non-ENOENT error (permissions, I/O error, path is weird).
Common situations: Running asdf without read permission on ASDF_DATA_DIR or the plugins directory, NFS/permission issues after switching users, or a data dir path that is a file instead of a directory.
Related errors
- unable to create download dir: %w
- unable to create install dir: %w
- unable to create file plugin index touch file: %w
- unable to check if plugin already exists: %w
- unable to create download dir: %w
AI-assisted analysis of asdf-vm/asdf@074a1722ca (2026-08-30).
Data as JSON: /api/errors/053a6109b8812735.
Report an issue: GitHub.