hashicorp/terraform · error
registry response includes invalid version string
Error message
registry response includes invalid version string %q: %s
What it means
Thrown while parsing the 'protocols' array from the registry's package-version response. Each protocol string is parsed with ParseVersion; the first that fails aborts the request as a registry query failure.
Solutions
- Report the malformed protocol string to the registry operator
- If self-hosting the registry, emit protocol versions as full 'MAJOR.MINOR.PATCH' without a 'v' prefix
- Confirm the registry endpoint implements the expected provider-protocol schema
Defensive patterns
Strategy: try-catch
Try / catch
meta, err := c.PackageMeta(ctx, provider, version, target)
if err != nil && strings.Contains(err.Error(), "invalid version string") {
return fmt.Errorf("registry returned a malformed protocol version for %s: %w", provider, err)
} Prevention
- Self-hosted registries must emit protocol versions as full semver without a 'v' prefix
- Monitor registry responses for schema regressions in the protocols field
When it happens
Trigger: ParseVersion(versionStr) returned an error for an entry in body.Protocols (e.g. '5', 'v5.2.0', '5.x', empty string, non-semver token).
Common situations: Registry returns a protocol string without required minor/patch components or with a leading 'v'; custom/airgapped registry emitting a non-semver format; schema regression where protocols field contains a single combined string instead of an array.
Related errors
- registry response includes invalid download URL
- registry response includes invalid download URL: must use…
- registry response includes invalid SHA256 hash
- registry response includes invalid SHASUMS signature URL
- registry response includes invalid SHASUMS URL: must use…
AI-assisted analysis of hashicorp/terraform@d32a084675 (2026-08-11).
Data as JSON: /api/errors/2d151a9934bbefa2.
Report an issue: GitHub.
Appendix: source
Thrown at internal/getproviders/registry_client.go:246
SHA256SumsURL string `json:"shasums_url"`
SHA256SumsSignatureURL string `json:"shasums_signature_url"`
SigningKeys SigningKeyList `json:"signing_keys"`
}
var body ResponseBody
dec := json.NewDecoder(resp.Body)
if err := dec.Decode(&body); err != nil {
return PackageMeta{}, c.errQueryFailed(provider, err)
}
var protoVersions VersionList
for _, versionStr := range body.Protocols {
v, err := ParseVersion(versionStr)
if err != nil {
return PackageMeta{}, c.errQueryFailed(
provider,
fmt.Errorf("registry response includes invalid version string %q: %s", versionStr, err),
)
}
protoVersions = append(protoVersions, v)
}
protoVersions.Sort()
// Verify that this version of terraform supports the providers' protocol
// version(s)
if len(protoVersions) > 0 {
supportedProtos := MeetingConstraints(SupportedPluginProtocols)
protoErr := ErrProtocolNotSupported{
Provider: provider,
Version: version,
}
match := false
for _, version := range protoVersions {
if supportedProtos.Has(version) {
match = trueView on GitHub (pinned to d32a084675)