jdx/mise · error

GitHub relay request denied or unavailable

Error message

GitHub relay request denied or unavailable

What it means

During CLI help rendering, mise replaces the section between the IDIOMATIC_FILES_START and IDIOMATIC_FILES_END markers in a template with a generated table of idiomatic version files. This error means both markers were found, but the start marker appears after the end marker in the content, so the slice range would be invalid. mise treats this as a broken internal template and aborts rather than rendering garbled help output.

Source

Thrown at src/github_relay.rs:597

        let result = tokio::select! {
            biased;
            _ = cancel.cancelled() => Err(eyre::eyre!("session ended")),
            result = tokio::time::timeout(audit.options.request_timeout, forward(broker, request)) => result.unwrap_or_else(|_| Err(eyre::eyre!("request timeout"))),
        };
        let status = result.as_ref().map(|r| r.status().as_u16()).unwrap_or(403);
        if status >= 400 {
            audit
                .denied
                .fetch_add(1, std::sync::atomic::Ordering::Relaxed);
        }
        if audit.options.log_requests && result.is_err() {
            audit.emit(serde_json::json!({"event": "request", "operation": operation, "status": status, "headers_ms": started.elapsed().as_millis()}));
        }
        match result {
            Ok(response) => response,
            // Deliberately never serialize upstream errors, URLs or credentials.
            Err(_) => Response::builder()
                .status(403)
                .body(Body::from("GitHub relay request denied or unavailable"))
                .expect("valid response"),
        }
    }

    async fn forward(broker: Broker, request: Request) -> Result<Response> {
        let deadline = tokio::time::Instant::now() + broker.audit.options.request_timeout;
        let operation = broker.audit.operation(&broker.scope, &request);
        let permit = broker.permits.clone().try_acquire_owned()?;
        let target = authorize(
            &broker.scope,
            request.method().as_str(),
            request.uri().path().strip_prefix('/').unwrap_or_default(),
            request.uri().query(),
        )?;
        let (parts, body) = request.into_parts();
        let body = to_bytes(body, 8 * 1024 * 1024).await?;
        if parts.method != Method::POST && !body.is_empty() {

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Open src/cli/render_help.rs and check the template content; ensure IDIOMATIC_FILES_START appears strictly before IDIOMATIC_FILES_END
  2. Restore the original ordering of the markers if a merge or edit swapped them
  3. Remove duplicated markers so .find() resolves the intended first occurrences
  4. Run `mise run render` to regenerate help output and confirm the table renders

Example fix

// before (template content)
// END idiomatic version files
...text...
// START idiomatic version files

// after (template content)
// START idiomatic version files
...table inserted here...
// END idiomatic version files
Defensive patterns

Strategy: validation

Validate before calling

let start = content.find(START_MARKER).expect("start marker missing");
let end = content.find(END_MARKER).expect("end marker missing");
assert!(start < end, "idiomatic files markers out of order in template");

Prevention

When it happens

Trigger: Calling render_idiomatic_version_files (via run) on content where .find(IDIOMATIC_FILES_END) returns a smaller index than .find(IDIOMATIC_FILES_START) + marker length — i.e. the END marker precedes the START marker in the help template.

Common situations: Someone edited or reordered the help template so the end marker moved above the start marker; a build step or translation/substitution mangled the template; duplicated markers confusing the .find() first-match lookups.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/50930078d641d551. Report an issue: GitHub.