{"record":{"id":"54bafa23c9f6ce89","repo":"hashicorp/packer","slug":"index-json-contains-no-versions","errorCode":null,"errorMessage":"index.json contains no versions","messagePattern":"index\\.json contains no versions","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packer/plugin-getter/remote/getter.go","lineNumber":82,"sourceCode":"\n// pluginIndex is the validated form of a plugin's index.json. Versions are\n// keyed by their canonical core string (e.g. \"1.1.4\"); all other index\n// content is ignored.\ntype pluginIndex struct {\n\tpluginType string\n\tversions   map[string]struct{}\n}\n\n// parseIndex validates raw index.json content into a pluginIndex.\nfunc parseIndex(data []byte, pluginType string) (*pluginIndex, error) {\n\tvar raw struct {\n\t\tVersions map[string]struct{} `json:\"versions\"`\n\t}\n\tif err := json.Unmarshal(data, &raw); err != nil {\n\t\treturn nil, fmt.Errorf(\"malformed index.json: %w\", err)\n\t}\n\tif len(raw.Versions) == 0 {\n\t\treturn nil, fmt.Errorf(\"index.json contains no versions\")\n\t}\n\n\tidx := &pluginIndex{\n\t\tpluginType: pluginType,\n\t\tversions:   map[string]struct{}{},\n\t}\n\tfor k := range raw.Versions {\n\t\tver, err := goversion.NewVersion(k)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"[WARN] remote-getter: ignoring unparseable version %q in index.json\", k)\n\t\t\tcontinue\n\t\t}\n\t\tidx.versions[ver.String()] = struct{}{}\n\t}\n\tif len(idx.versions) == 0 {\n\t\treturn nil, fmt.Errorf(\"index.json contains no usable versions\")\n\t}\n\treturn idx, nil","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/packer/plugin-getter/remote/getter.go#L64-L100","documentation":"After successfully unmarshaling index.json, parseIndex requires at least one entry under `versions`. An empty or versions-less object means the remote (or cached) index advertises no plugin versions at all, so there is nothing to resolve releases from.","triggerScenarios":"parseIndex receives valid JSON like {} or {\"versions\": {}}; loadIndex then returns this error to callers such as Get(\"releases\") and versionURL.","commonSituations":"A newly created plugin on the registry with no published releases yet; an index.json truncated/regenerated without versions; pointing a custom plugin registry mirror at an empty bucket.","solutions":["Verify the plugin actually has published versions on the registry/releases host.","Check you are querying the correct plugin type/organization (typos route to an empty index).","Re-fetch or regenerate index.json if a custom mirror served an empty file."],"exampleFix":"// before\n{\"versions\": {}}\n// after\n{\"versions\": {\"1.1.1\": {}}}","handlingStrategy":"validation","validationCode":"var idx struct{ Versions map[string]json.RawMessage `json:\"versions\"` }\nif json.Unmarshal(body, &idx) == nil && len(idx.Versions) == 0 {\n    return errors.New(\"plugin has no published versions; check registry\")\n}","typeGuard":null,"tryCatchPattern":"if _, err := g.Get(\"releases\", opts); err != nil && strings.Contains(err.Error(), \"contains no versions\") {\n    // verify plugin address and that releases exist upstream\n}","preventionTips":["Confirm a plugin has published releases before adding it to required_plugins.","Double-check org/repo spelling in the plugin source address.","Keep custom registry mirrors in sync with upstream releases."],"tags":["packer","plugin-getter","empty-index","registry"],"backgroundTag":"empty-version-index","analyzedSha":"eb36e3c3e48a036f3e8cc94087636ee72e1303c9","analyzedAt":"2026-09-05T13:20:43.127Z","contentChangedAt":"2026-09-05T13:20:43.127Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}