{"record":{"id":"45065e6950c85f10","repo":"jdx/mise","slug":"fetching-current-index-for-url-failed","errorCode":null,"errorMessage":"fetching current index for {url} failed: {}","messagePattern":"fetching current index for (.+?) failed: (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/oci/registry.rs","lineNumber":1580,"sourceCode":"            MEDIA_TYPE_OCI_MANIFEST,\n            MEDIA_TYPE_DOCKER_MANIFEST,\n        ]\n        .join(\", \");\n        let resp = self\n            .session\n            .send(|auth| {\n                let mut rb = HTTP.reqwest()?.get(&url).header(\"Accept\", &accept);\n                if let Some(a) = auth {\n                    rb = rb.header(\"Authorization\", a);\n                }\n                Ok(rb)\n            })\n            .await\n            .wrap_err_with(|| format!(\"GET {url}\"))?;\n        match resp.status() {\n            StatusCode::OK => {}\n            StatusCode::NOT_FOUND => return Ok(vec![]),\n            s => bail!(\"fetching current index for {url} failed: {}\", s.as_u16()),\n        }\n        let content_type = header_str(&resp, \"content-type\");\n        let bytes = resp.bytes().await?;\n        let body: serde_json::Value = serde_json::from_slice(&bytes)?;\n\n        // Already an index — take its entries.\n        if body.get(\"manifests\").map(|m| m.is_array()).unwrap_or(false) {\n            let index: ImageIndex =\n                serde_json::from_slice(&bytes).wrap_err(\"parsing existing image index\")?;\n            return Ok(index.manifests);\n        }\n\n        // A single-platform manifest: wrap it as an index entry so its\n        // platform survives the upgrade to an index.\n        match self\n            .wrap_single_manifest(&bytes, &body, &content_type)\n            .await\n        {","sourceCodeStart":1562,"sourceCodeEnd":1598,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/oci/registry.rs#L1562-L1598","documentation":"existing_index_entries fetches the current tag index (manifest) for a URL; any status other than 200 (index found) or 404 (treated as empty index) raises this error. The status code is included so the developer can tell whether it is auth, permission, or a server problem.","triggerScenarios":"update_tag_index calls existing_index_entries and the GET of the manifest returns e.g. 401 (bad credentials), 403 (read denied), 5xx (registry outage), or 429 (rate limit) — anything not 200/404.","commonSituations":"Private repository fetched without a token, anonymous requests rate-limited by Docker Hub/GHCR, transient registry 5xx during an update, proxy intercepting the request.","solutions":["Check the status code in the message: 401/403 → fix credentials/permissions; 5xx → retry later","Ensure a valid read token is configured for private repositories","Retry after backoff if the registry returned 429 or 5xx","Verify the registry URL and repository name are correct"],"exampleFix":"// before\n// fetching current index for https://ghcr.io/v2/org/img/manifests/index failed: 401\n// after\n// supply credentials for ghcr.io before running the tag-index update","handlingStrategy":"retry","validationCode":"// curl -I the manifest URL with the same token to confirm 200/404 before calling the API","typeGuard":null,"tryCatchPattern":"try { entries = await existingIndexEntries(url) } catch (e) { if (/failed: (5\\d\\d|429)/.test(e.message)) await backoffRetry(); else throw e; }","preventionTips":["Supply a read token for private repositories","Handle 404 as 'no index yet' in your own workflow","Retry on 429/5xx with backoff","Verify registry URL and repo path before calling"],"tags":["oci","registry","http","tag-index"],"backgroundTag":"http-error-response","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}