Skip to content

Code Quality: Leader endpoint parse failures silently hidden #30

@drmingdrmer

Description

@drmingdrmer

Summary

When the leader's gRPC address is malformed, Endpoint::parse() silently returns None instead of surfacing the error.

Location

crates/service/src/meta_node/meta_node.rs:1630

Endpoint::parse(addr).ok()

Problem

If a node's grpc_api_advertise_address contains an invalid address, the error is silently swallowed. Users see "no leader available" when the actual problem is a configuration error.

This could waste hours of debugging because:

  • The actual error is hidden
  • "No leader" suggests a cluster health issue, not a config issue
  • No logging indicates what went wrong

Impact

  • Configuration errors appear as cluster failures
  • Difficult to diagnose misconfigured nodes
  • Misleading error messages to operators

Suggested Fix

Return a proper error:

fn get_leader_endpoint(&self, addr: &str) -> Result<Endpoint, MetaError> {
    Endpoint::parse(addr).map_err(|e| {
        MetaError::InvalidConfig(format!(
            "Invalid leader endpoint '{}': {}", addr, e
        ))
    })
}

Priority

P3 - Debuggability improvement

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions