asdf-vm/asdf · error

error fetching plugin URL: %s

Error message

error fetching plugin URL: %s

What it means

When Add is called with a short plugin name (no explicit URL), asdf looks the name up in the plugin index via pluginindex.Build(...).GetPluginSourceURL. If that lookup fails (name not in index, network/git failure fetching the index, or stale cached index), the error is wrapped as "error fetching plugin URL". The wrapped inner error tells you which of these happened.

Source

Thrown at internal/plugins/plugins.go:398

		disablePluginIndex, _ := config.DisablePluginShortNameRepository()

		if disablePluginIndex {
			return fmt.Errorf("Short-name plugin repository is disabled")
		}

		lastCheckDuration := 0
		// We don't care about errors here as we can use the default value
		checkDuration, _ := config.PluginRepositoryLastCheckDuration()

		if !checkDuration.Never {
			lastCheckDuration = checkDuration.Every
		}

		index := pluginindex.Build(config.DataDir, config.PluginIndexURL, false, lastCheckDuration)
		var err error
		pluginURL, err = index.GetPluginSourceURL(pluginName)
		if err != nil {
			return fmt.Errorf("error fetching plugin URL: %s", err)
		}
	}

	plugin.URL = pluginURL

	// Run pre hooks
	hook.Run(config, "pre_asdf_plugin_add", []string{plugin.Name})
	hook.Run(config, fmt.Sprintf("pre_asdf_plugin_add_%s", plugin.Name), []string{})

	err = git.NewRepo(plugin.Dir).Clone(plugin.URL, ref)
	if err != nil {
		return err
	}

	err = os.MkdirAll(data.DownloadDirectory(config.DataDir, plugin.Name), 0o777)
	if err != nil {
		return err
	}

View on GitHub (pinned to 074a1722ca)

Solutions

  1. Verify the exact plugin name exists in the plugin index (https://github.com/asdf-vm/asdf-plugins); fix typos
  2. Add the plugin with an explicit git URL instead of a short name to skip the index lookup entirely
  3. Check network/proxy access to the index git repository; test with `git ls-remote <index-url>`
  4. Inspect the wrapped error text — if it mentions git clone, fix the PluginIndexURL or clear the stale index cache under config.DataDir

Example fix

// before
err := plugins.Add(conf, "nodjs", "", "", os.Stdout) // typo -> index lookup fails
// after
err := plugins.Add(conf, "nodejs", "https://github.com/asdf-vm/asdf-nodejs.git", "", os.Stdout)
Defensive patterns

Strategy: fallback

Validate before calling

// verify name is known in index before Add:
url, err := index.GetPluginSourceURL(name)
if err != nil { url = "https://github.com/asdf-vm/asdf-" + name } // or error out

Try / catch

if err != nil {
    var inner error = errors.Unwrap(err)
    // inspect inner: git failure vs name-not-found, then retry with explicit URL
}

Prevention

When it happens

Trigger: plugins.Add with empty pluginURL where GetPluginSourceURL returns an error: plugin name not present in the index, the plugin index repo failed to clone/update (network down, bad PluginIndexURL), or the cached index is unreadable.

Common situations: Typo'd plugin short name (`asdf plugin add nodejs-lts`), offline/air-gapped environment blocking the index git fetch, custom ASDF_PLUGIN_INDEX_URL (config.PluginIndexURL) pointing at a missing or private repo.

Related errors


AI-assisted analysis of asdf-vm/asdf@074a1722ca (2026-08-30). Data as JSON: /api/errors/f38a4960561b6de6. Report an issue: GitHub.