{"record":{"id":"6a63e5a621206ea0","repo":"asdf-vm/asdf","slug":"unable-to-initialize-index-w","errorCode":null,"errorMessage":"unable to initialize index: %w","messagePattern":"unable to initialize index: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/pluginindex/pluginindex.go","lineNumber":82,"sourceCode":"// Refresh may update the plugin repo if it hasn't been updated in longer\n// than updateDurationMinutes. If the plugin repo needs to be updated the\n// repo will be invoked to perform the actual Git pull.\nfunc (p PluginIndex) Refresh() (bool, error) {\n\terr := os.MkdirAll(p.directory, os.ModePerm)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tfiles, err := os.ReadDir(p.directory)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tif len(files) == 0 {\n\t\t// directory empty, clone down repo\n\t\terr := p.repo.Clone(p.url, \"\")\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"unable to initialize index: %w\", err)\n\t\t}\n\n\t\treturn touchFS(p.directory)\n\t}\n\n\t// directory must not be empty, repo must be present, maybe update\n\tupdated, err := lastUpdated(p.directory)\n\tif err != nil {\n\t\treturn p.doUpdate()\n\t}\n\n\t// Convert minutes to nanoseconds\n\tupdateDurationNs := int64(p.updateDurationMinutes) * (6e10)\n\n\tif updated > updateDurationNs && !p.disableUpdate {\n\t\treturn p.doUpdate()\n\t}\n","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/asdf-vm/asdf/blob/074a1722ca88d6677f228541ce06efaf4f9924d4/internal/pluginindex/pluginindex.go#L64-L100","documentation":"PluginIndex.Refresh initializes the plugin index repository. When the index directory is empty, it clones the asdf-plugins repository via p.repo.Clone(p.url, \"\"); if the clone fails the error is wrapped as 'unable to initialize index'. It means the plugin index could not be fetched from the remote git URL.","triggerScenarios":"Calling Refresh (directly or via Get/GetPluginSourceURL) when the index directory is empty and: there is no network connectivity; the remote URL is wrong or unreachable; git is missing; git authentication is required (behind a proxy) but not configured.","commonSituations":"First run of asdf on a fresh machine with no internet; corporate proxy/firewall blocking github.com; misconfigured ASDF config pointing at a dead index URL; DNS failures in containers.","solutions":["Verify network connectivity to the index host (e.g. git ls-remote <index-url>).","Configure git/HTTPS proxy settings if behind a corporate proxy (git config --global http.proxy ...).","Confirm the index URL in config is correct and reachable.","Ensure git is installed and on PATH, then retry Refresh."],"exampleFix":"// before: clone fails behind proxy\ngit ls-remote https://github.com/asdf-vm/asdf-plugins.git\n// after\ngit config --global http.proxy http://proxy.corp:8080\nrm -rf \"${ASDF_DATA_DIR:-$HOME/.asdf}/repository\" && asdf plugin list all","handlingStrategy":"retry","validationCode":"url := p.url // e.g. https://github.com/asdf-vm/asdf-plugins.git\nif _, err := exec.LookPath(\"git\"); err != nil {\n    return fmt.Errorf(\"git required: %w\", err)\n}\nif err := exec.Command(\"git\", \"ls-remote\", url, \"HEAD\").Run(); err != nil {\n    return fmt.Errorf(\"index remote unreachable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"ok, err := idx.Refresh()\nif err != nil && strings.Contains(err.Error(), \"unable to initialize index\") {\n    time.Sleep(2 * time.Second) // transient network?\n    ok, err = idx.Refresh()\n}","preventionTips":["Configure git proxy settings before first asdf use in corporate networks.","Prime the index with a one-time clone during image builds (pre-bake).","Verify connectivity to github.com in CI before running asdf commands.","Keep git installed and updated."],"tags":["git","network","plugin-index"],"backgroundTag":"git-clone-failed","analyzedSha":"074a1722ca88d6677f228541ce06efaf4f9924d4","analyzedAt":"2026-08-30T19:56:42.972Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}