{"record":{"id":"0f5a9def078ce5cd","repo":"hashicorp/terraform","slug":"provider-mirror-returned-invalid-url-q-s","errorCode":null,"errorMessage":"provider mirror returned invalid URL %q: %s","messagePattern":"provider mirror returned invalid URL %q: (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/getproviders/http_mirror_source.go","lineNumber":224,"sourceCode":"\tif err := dec.Decode(&bodyContent); err != nil {\n\t\treturn PackageMeta{}, s.errQueryFailed(provider, fmt.Errorf(\"invalid response content from mirror server: %s\", err))\n\t}\n\n\tarchiveMeta, ok := bodyContent.Archives[target.String()]\n\tif !ok {\n\t\treturn PackageMeta{}, ErrPlatformNotSupported{\n\t\t\tProvider:  provider,\n\t\t\tVersion:   version,\n\t\t\tPlatform:  target,\n\t\t\tMirrorURL: s.baseURL,\n\t\t}\n\t}\n\n\trelURL, err := url.Parse(archiveMeta.RelativeURL)\n\tif err != nil {\n\t\treturn PackageMeta{}, s.errQueryFailed(\n\t\t\tprovider,\n\t\t\tfmt.Errorf(\"provider mirror returned invalid URL %q: %s\", archiveMeta.RelativeURL, err),\n\t\t)\n\t}\n\tabsURL := finalURL.ResolveReference(relURL)\n\n\tret := PackageMeta{\n\t\tProvider:       provider,\n\t\tVersion:        version,\n\t\tTargetPlatform: target,\n\n\t\tLocation: PackageHTTPURL(absURL.String()),\n\t\tFilename: path.Base(absURL.Path),\n\t}\n\t// A network mirror might not provide any hashes at all, in which case\n\t// the package has no source-defined authentication whatsoever.\n\tif len(archiveMeta.Hashes) > 0 {\n\t\thashes := make([]Hash, 0, len(archiveMeta.Hashes))\n\t\tfor _, hashStr := range archiveMeta.Hashes {\n\t\t\thash, err := ParseHash(hashStr)","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/getproviders/http_mirror_source.go#L206-L242","documentation":"Each archive entry in the version JSON carries a \"url\" field (RelativeURL). The code url.Parse()s it to resolve against the final request URL; if parsing fails the query is failed via errQueryFailed with this message, quoting the offending URL and the parse error. It signals a malformed archive URL in the mirror's response.","triggerScenarios":"An archive entry's \"url\" field contains characters that are illegal in a URL reference (raw spaces, control chars, unencoded non-ASCII), or an invalid escape. The mirror published a bad relative/absolute URL.","commonSituations":"Mirror generator forgot to URL-encode filenames; a filename with spaces or special characters; hand-edited JSON with a typo.","solutions":["Inspect the version JSON and the failing archive entry's \"url\" value.","Ensure the mirror percent-encodes any reserved/space characters in archive URLs.","Regenerate the version file with valid URL references."],"exampleFix":"# before: bad url in version json\n{\"archives\":{\"linux_amd64\":{\"url\":\"../aws 5.2.0.zip\"}}}\n\n# after: percent-encoded\n{\"archives\":{\"linux_amd64\":{\"url\":\"../aws%205.2.0.zip\"}}}","handlingStrategy":"try-catch","validationCode":"// Validate archive URLs parse before publishing a mirror.\nif _, err := url.Parse(entry.RelativeURL); err != nil {\n    return fmt.Errorf(\"archive url %q invalid: %w\", entry.RelativeURL, err)\n}","typeGuard":null,"tryCatchPattern":"var qf getproviders.ErrQueryFailed\nif errors.As(err, &qf) && strings.Contains(qf.Error(), \"invalid URL\") {\n    // mirror published a bad archive url; surface to operator\n}","preventionTips":["Percent-encode spaces and reserved characters in archive filenames.","url.Parse-check every archive URL during mirror generation.","Avoid hand-editing version JSON."],"tags":["protocol","mirror","url"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}