rustfs/rustfs · error · TargetError

Unknown error: {0}

Error message

Unknown error: {0}

What it means

TargetError::Unknown is the catch-all wrapper. Live sites: the replay/IPC layer flattens any sidecar-adapter error that matches no known variant into Unknown(other.to_string()) (runtime/mod.rs:1656); QueuedPayload::decode failures during replay scans map to Unknown (runtime/mod.rs:2291-2292); Redis returns it as the last-resort after retries are exhausted (redis.rs:571); the audit registry uses it for close failures. By design the original context survives only inside the string payload, so the detail text is the only diagnostic.

Source

Thrown at crates/targets/src/error.rs:82

    #[error("Configuration error: {0}")]
    Configuration(String),

    #[error("Encoding error: {0}")]
    Encoding(String),

    #[error("Serialization error: {0}")]
    Serialization(String),

    #[error("Target not connected")]
    NotConnected,

    #[error("Target initialization failed: {0}")]
    Initialization(String),

    #[error("Invalid ARN: {0}")]
    InvalidARN(String),

    #[error("Unknown error: {0}")]
    Unknown(String),

    #[error("Target is disabled")]
    Disabled,

    #[error("Queued payload dropped: {0}")]
    Dropped(String),

    #[error("Configuration parsing error: {0}")]
    ParseError(String),

    #[error("Failed to save configuration: {0}")]
    SaveConfig(String),

    #[error("Server not initialized: {0}")]
    ServerNotInitialized(String),
}

View on GitHub (pinned to 35af688cd9)

Solutions

  1. Read the embedded string first — it is the formatted source error and usually names the real cause.
  2. If it wraps a decode failure, inspect the queue directory for corruption, disk-full, or version drift; move suspicious entries out and let the scan continue.
  3. Reproduce with debug logging around the adapter to recover the original error chain.
  4. If an external plugin produced it, extend the adapter to map its errors into specific TargetError variants instead of the fallback.

Example fix

// before: adapter collapses every custom error into Unknown
other => TargetError::Unknown(other.to_string()),

// after: map the plugin's variant explicitly before falling back
MyPluginError::Auth(e) => TargetError::Authentication(e),
MyPluginError::Io(e) => TargetError::Network(e),
other => TargetError::Unknown(other.to_string()),
Defensive patterns

Strategy: try-catch

Type guard

fn is_unknown(e: &rustfs_targets::TargetError) -> bool {
    matches!(e, rustfs_targets::TargetError::Unknown(_))
}

Try / catch

match result {
    Err(rustfs_targets::TargetError::Unknown(detail)) => {
        // catch-all: the string is the only diagnostic — log it verbatim with context
        tracing::error!(component = "target", detail, "unclassified target error");
    }
    _ => {}
}

Prevention

When it happens

Trigger: A plugin/sidecar adapter returns a custom error type not in the TargetError vocabulary during send or lifecycle; a corrupted or version-mismatched queued payload fails QueuedPayload::decode at replay time; Redis exhausts all retry attempts with a non-classified error.

Common situations: External target plugins with their own error enums; queue directories written by an older RustFS version being read by a newer one (or vice versa); partial writes to the store after disk-full; genuinely novel broker errors the adapter does not map.

Related errors


AI-assisted analysis of rustfs/rustfs@35af688cd9 (2026-08-20). Data as JSON: /api/errors/cbfb5c7cb75f8302. Report an issue: GitHub.