jdx/mise · error

invalid remote action manifest ETag

Error message

invalid remote action manifest ETag

What it means

`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.

Solutions

  1. Only pass etags previously returned by `get_action_manifest` on the same server - store `RemoteActionManifest.etag` verbatim.
  2. If you persist etags, key them by server URL and invalidate them whenever the server configuration changes.
  3. Pass `None` as `expected_etag` to upload unconditionally when the etag provenance is uncertain.
  4. If you must normalize, remember only a 64-char lowercase hex string will pass; anything else will still bail.

Example fix

// before: hand-normalized etag (uppercase, quoted) - bails
let etag = format!("\"{}\"", hash.to_ascii_uppercase());
cache.put_action_manifest(&key, &bytes, Some(&etag)).await?;

// after: reuse the etag from get_action_manifest verbatim, or omit it
let etag = cache.get_action_manifest(&key).await?.map(|m| m.etag);
cache.put_action_manifest(&key, &bytes, etag.as_deref()).await?;
Defensive patterns

Strategy: validation

Validate before calling

fn is_lower_hex_digest(v: &str) -> bool {
    v.len() == 64 && v.bytes().all(|b| b.is_ascii_digit() || (b'a'..=b'f').contains(&b))
}
// before uploading with a conditional match:
let expected = cached_etag.filter(|e| is_lower_hex_digest(e)); // foreign etags become None
cache.put_action_manifest(&key, &bytes, expected.as_deref()).await?;

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of jdx/mise@6f52dcdf99 (2026-08-22). Data as JSON: /api/errors/d287fd9cf9711a9c. Report an issue: GitHub.

Appendix: source

Thrown at crates/mise-cache-core/src/lib.rs:1016

        }
    }
}

fn parse_strong_etag(value: Option<&HeaderValue>) -> Result<String> {
    let value = value
        .and_then(|value| value.to_str().ok())
        .ok_or_else(|| eyre!("remote action manifest response is missing an ETag"))?;
    let etag = value
        .strip_prefix('"')
        .and_then(|value| value.strip_suffix('"'))
        .filter(|value| is_lower_hex_digest(value))
        .ok_or_else(|| eyre!("remote action manifest response has an invalid ETag"))?;
    Ok(etag.to_owned())
}

fn quoted_etag(etag: &str) -> Result<HeaderValue> {
    if !is_lower_hex_digest(etag) {
        bail!("invalid remote action manifest ETag");
    }
    Ok(HeaderValue::from_str(&format!("\"{etag}\""))?)
}

fn is_lower_hex_digest(value: &str) -> bool {
    value.len() == 64
        && value
            .bytes()
            .all(|byte| byte.is_ascii_digit() || (b'a'..=b'f').contains(&byte))
}

#[derive(Clone)]
enum RemoteCacheCredential {
    None,
    Static(HeaderValue),
    File(PathBuf),
    GithubActions(Arc<GithubActionsOidcCredential>),
}

View on GitHub (pinned to 6f52dcdf99)