nikivdev/code · error

remote review unauthorized. Run `f auth` to login.

Error message

remote review unauthorized. Run `f auth` to login.

What it means

The remote review HTTP request completed but the server responded 401 Unauthorized. The library maps that specific status to this message instructing the user to authenticate with `f auth`. It indicates missing, expired, or invalid auth credentials for the myflow review service.

Source

Thrown at src/commit.rs:5485

    };

    let client = crate::http_client::blocking_with_timeout(Duration::from_secs(
        commit_with_check_timeout_secs(),
    ))
    .context("failed to create HTTP client for remote review")?;

    let mut request = client.post(&review_url).json(&payload);
    if let Some(token) = commit_with_check_review_token() {
        request = request.bearer_auth(token);
    }

    let response = request
        .send()
        .context("failed to send remote review request")?;

    if !response.status().is_success() {
        if response.status() == StatusCode::UNAUTHORIZED {
            bail!("remote review unauthorized. Run `f auth` to login.");
        }
        if response.status() == StatusCode::PAYMENT_REQUIRED {
            bail!("remote review requires an active subscription. Visit myflow to subscribe.");
        }
        bail!("remote review failed: HTTP {}", response.status());
    }

    let payload: RemoteReviewResponse = response
        .json()
        .context("failed to parse remote review response")?;

    if !payload.stderr.trim().is_empty() {
        debug!(stderr = payload.stderr.as_str(), "remote claude stderr");
    }

    let result = payload.output;
    let mut review_json = parse_review_json(&result);
    let future_tasks = review_json

View on GitHub (pinned to a747e741ae)

Solutions

  1. Run `f auth` to log in and refresh credentials, then retry the review.
  2. Delete stale cached credentials and re-authenticate.
  3. In CI, provision a valid API token/credentials as a secret.
  4. Check system clock if tokens are time-based (`timedatectl`).
Defensive patterns

Strategy: try-catch

Validate before calling

// preflight: cheap authenticated check before the review
let status = reqwest::Client::new()
    .get(format!("{base}/me"))
    .bearer_auth(token)
    .send().await?
    .status();
if status == reqwest::StatusCode::UNAUTHORIZED {
    anyhow::bail!("not authenticated; run `f auth`");
}

Try / catch

match run_remote_review(&diff).await {
    Ok(r) => r,
    Err(e) if e.to_string().contains("remote review unauthorized") => {
        eprintln!("Auth expired — run `f auth` first.");
        std::process::exit(2);
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: POSTing the RemoteReviewRequest to the review URL when the stored auth token is absent, expired, or rejected (StatusCode::UNAUTHORIZED).

Common situations: Never logged in (`f auth` not run); login token expired; token revoked server-side; running in CI without auth credentials; clock skew invalidating the token.

Understand the failure class

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/153bd1885241af89. Report an issue: GitHub.