asdf-vm/asdf · error
unable to create download dir: %w
Error message
unable to create download dir: %w
What it means
installtest.InstallOneVersion prepares a sandboxed install to test a plugin version: it creates ASDF_DOWNLOAD_PATH via os.MkdirAll before running the plugin's download/install callbacks. If the directory cannot be created, the wrapped error "unable to create download dir" is returned.
Source
Thrown at internal/installtest/installtest.go:46
err := plugin.Exists()
if err != nil {
return err
}
downloadDir := DownloadPath(conf, plugin, version)
installDir := InstallPath(conf, plugin, version)
env := map[string]string{
"ASDF_INSTALL_TYPE": versionType,
"ASDF_INSTALL_VERSION": version,
"ASDF_INSTALL_PATH": installDir,
"ASDF_DOWNLOAD_PATH": downloadDir,
"ASDF_CONCURRENCY": "1",
}
err = os.MkdirAll(downloadDir, 0o777)
if err != nil {
return fmt.Errorf("unable to create download dir: %w", err)
}
err = plugin.RunCallback("download", []string{}, env, &stdOut, &stdErr)
if _, ok := err.(plugins.NoCallbackError); err != nil && !ok {
return fmt.Errorf("failed to run download callback: %w", err)
}
err = os.MkdirAll(installDir, 0o777)
if err != nil {
return fmt.Errorf("unable to create install dir: %w", err)
}
err = plugin.RunCallback("install", []string{}, env, &stdOut, &stdErr)
if err != nil {
return fmt.Errorf("failed to run install callback: %w", err)
}
return nilView on GitHub (pinned to 074a1722ca)
Solutions
- Check and fix permissions on the asdf data dir (typically ~/.asdf): `ls -ld ~/.asdf` and `chown`/`chmod` as needed.
- Free disk space or raise quota if the filesystem is full.
- Remove any conflicting file at the download path so MkdirAll can create the directory.
- Avoid running asdf with sudo, which creates root-owned dirs; fix ownership of previously created dirs.
Example fix
# before (root-owned ~/.asdf) sudo asdf install nodejs 20.11.0 # after sudo chown -R $(whoami) ~/.asdf asdf install nodejs 20.11.0
Defensive patterns
Strategy: validation
Validate before calling
test -w "${ASDF_DATA_DIR:-$HOME/.asdf}" || { echo "asdf data dir not writable"; exit 1; }
df -h "${ASDF_DATA_DIR:-$HOME/.asdf}" | awk 'NR==2 && $5+0 >= 100 {exit 1}' Try / catch
if ! asdf install "$PLUGIN" "$VER" 2>&1 | grep -q 'unable to create download dir'; then :; else
sudo chown -R "$(whoami)" "${ASDF_DATA_DIR:-$HOME/.asdf}" && asdf install "$PLUGIN" "$VER"
fi Prevention
- Never run asdf under sudo; fix ownership of root-created dirs
- Keep the asdf data dir (~/.asdf) writable by your user
- Monitor disk space/quota on the volume holding ~/.asdf
- Remove stale files that block directory creation at download paths
When it happens
Trigger: Running `asdf install <plugin> <version>` (which exercises install tests) where the download path's parent is unwritable, the disk is full, a file exists where the directory should be, or a leftover directory has wrong permissions.
Common situations: Read-only ASDF_DATA_DIR (e.g. ~/.asdf mounted read-only in containers/CI); permission changes after running asdf as root/sudo previously; disk quota exceeded.
Related errors
- unable to create install dir: %w
- unable to create download dir: %w
- unable to create file plugin index touch file: %w
- unable to check if plugin already exists: %w
- unable to check if plugin exists: %w
AI-assisted analysis of asdf-vm/asdf@074a1722ca (2026-08-30).
Data as JSON: /api/errors/c5e7781b1b261e3f.
Report an issue: GitHub.