block/buzz · critical · anyhow::Error

failed to initialize media storage: {e}

Error message

failed to initialize media storage: {e}

What it means

MediaStorage::new() constructs the actual storage client (S3/Blossom endpoint) after validation has passed. Failures at this stage — a malformed endpoint URL, credentials rejected during client construction, or an unsupported backend combination — abort startup with the SDK-level error appended.

Source

Thrown at crates/buzz-relay/src/main.rs:453

        tracing::warn!(
            pubkey = %keys.public_key().to_hex(),
            "Using hardcoded dev relay keypair (BUZZ_REQUIRE_AUTH_TOKEN=false). \
             Set BUZZ_RELAY_PRIVATE_KEY for production."
        );
        keys
    } else {
        panic!(
            "BUZZ_RELAY_PRIVATE_KEY must be set when BUZZ_REQUIRE_AUTH_TOKEN=true. \
             A stable relay identity is required for production."
        );
    };

    config
        .media
        .validate()
        .map_err(|e| anyhow::anyhow!("invalid media config: {e}"))?;
    let media_storage = buzz_media::MediaStorage::new(&config.media)
        .map_err(|e| anyhow::anyhow!("failed to initialize media storage: {e}"))?;
    info!("Media storage connected");

    let (app_state, audit_shutdown) = AppState::new(
        config.clone(),
        db,
        redis_health_pool,
        audit,
        pubsub,
        auth,
        search,
        Arc::clone(&workflow_engine),
        relay_keypair,
        media_storage,
    );
    let state = Arc::new(app_state);

    // Inter-relay mesh (BUZZ_MESH seam). `boot_mesh` returns None when the
    // kill switch is off — nothing is bound, published, or spawned, so the

View on GitHub (pinned to f956e6fe06)

Solutions

  1. Check {e} for the SDK-level cause it wraps
  2. Fix the media endpoint URL (include the scheme) and provide the full credential pair
  3. Rehearse the same values outside the relay: `aws s3 ls --endpoint-url ...`

Example fix

# before
BUZZ_MEDIA_S3_ENDPOINT=minio.internal:9000

# after
BUZZ_MEDIA_S3_ENDPOINT=http://minio.internal:9000
Defensive patterns

Strategy: validation

Validate before calling

# Rehearse the storage config outside the relay before boot.
aws s3 ls --endpoint-url "$BUZZ_MEDIA_S3_ENDPOINT" s3://$BUZZ_MEDIA_S3_BUCKET/ || { echo 'media storage not usable'; exit 1; }

Prevention

When it happens

Trigger: The media/S3 endpoint URL is malformed (e.g. MinIO endpoint without a scheme), region/credential configuration rejected by the SDK at construction, or partial credentials (access key without secret).

Common situations: Typo'd local MinIO endpoint (missing http://); wrong region codes; only one of the credential pair injected by the secret store.

Related errors


AI-assisted analysis of block/buzz@f956e6fe06 (2026-08-16). Data as JSON: /api/errors/5e2ec4a3b7550791. Report an issue: GitHub.