{"record":{"id":"d287fd9cf9711a9c","repo":"jdx/mise","slug":"invalid-remote-action-manifest-etag","errorCode":null,"errorMessage":"invalid remote action manifest ETag","messagePattern":"invalid remote action manifest ETag","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/mise-cache-core/src/lib.rs","lineNumber":1016,"sourceCode":"        }\n    }\n}\n\nfn parse_strong_etag(value: Option<&HeaderValue>) -> Result<String> {\n    let value = value\n        .and_then(|value| value.to_str().ok())\n        .ok_or_else(|| eyre!(\"remote action manifest response is missing an ETag\"))?;\n    let etag = value\n        .strip_prefix('\"')\n        .and_then(|value| value.strip_suffix('\"'))\n        .filter(|value| is_lower_hex_digest(value))\n        .ok_or_else(|| eyre!(\"remote action manifest response has an invalid ETag\"))?;\n    Ok(etag.to_owned())\n}\n\nfn quoted_etag(etag: &str) -> Result<HeaderValue> {\n    if !is_lower_hex_digest(etag) {\n        bail!(\"invalid remote action manifest ETag\");\n    }\n    Ok(HeaderValue::from_str(&format!(\"\\\"{etag}\\\"\"))?)\n}\n\nfn is_lower_hex_digest(value: &str) -> bool {\n    value.len() == 64\n        && value\n            .bytes()\n            .all(|byte| byte.is_ascii_digit() || (b'a'..=b'f').contains(&byte))\n}\n\n#[derive(Clone)]\nenum RemoteCacheCredential {\n    None,\n    Static(HeaderValue),\n    File(PathBuf),\n    GithubActions(Arc<GithubActionsOidcCredential>),\n}","sourceCodeStart":998,"sourceCodeEnd":1034,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/crates/mise-cache-core/src/lib.rs#L998-L1034","documentation":"`quoted_etag` is used by `put_action_manifest` to turn a previously observed ETag into a quoted `If-Match` header value. It accepts exactly a 64-character lowercase hex string (a blake3 hash, the same shape `parse_strong_etag` extracts from GET responses) and rejects everything else before any request is sent. Uppercase hex, a weak `W/\"...\"` prefix, embedded quotes, or a hash of the wrong length all fail.","triggerScenarios":"Calling `put_action_manifest(key, bytes, Some(etag))` with an etag that did not come from `get_action_manifest` on the same server: an etag persisted from a different server implementation that uses arbitrary or sha1-based etags, a hand-normalized (uppercased or pre-quoted) hash, or a truncated digest string.","commonSituations":"Switching the remote cache URL to a different server while reusing locally cached etags; writing custom etag persistence that normalizes or reformats values; interop with cache servers whose etags are not bare blake3 hex.","solutions":["Only pass etags previously returned by `get_action_manifest` on the same server - store `RemoteActionManifest.etag` verbatim.","If you persist etags, key them by server URL and invalidate them whenever the server configuration changes.","Pass `None` as `expected_etag` to upload unconditionally when the etag provenance is uncertain.","If you must normalize, remember only a 64-char lowercase hex string will pass; anything else will still bail."],"exampleFix":"// before: hand-normalized etag (uppercase, quoted) - bails\nlet etag = format!(\"\\\"{}\\\"\", hash.to_ascii_uppercase());\ncache.put_action_manifest(&key, &bytes, Some(&etag)).await?;\n\n// after: reuse the etag from get_action_manifest verbatim, or omit it\nlet etag = cache.get_action_manifest(&key).await?.map(|m| m.etag);\ncache.put_action_manifest(&key, &bytes, etag.as_deref()).await?;","handlingStrategy":"validation","validationCode":"fn is_lower_hex_digest(v: &str) -> bool {\n    v.len() == 64 && v.bytes().all(|b| b.is_ascii_digit() || (b'a'..=b'f').contains(&b))\n}\n// before uploading with a conditional match:\nlet expected = cached_etag.filter(|e| is_lower_hex_digest(e)); // foreign etags become None\ncache.put_action_manifest(&key, &bytes, expected.as_deref()).await?;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Store `RemoteActionManifest.etag` verbatim and pass it back unmodified.","Key any persisted etags by server URL and invalidate them when the server changes.","When in doubt, pass `None` for `expected_etag` to upload unconditionally."],"tags":["remote-cache","etag","http-headers","action-manifest","rust"],"backgroundTag":"invalid-etag","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}