neondatabase/neon · error

unsupported linekind: {s}

Error message

unsupported linekind: {s}

What it means

The draw_timeline_dir command renders horizontal guide lines and parses a --linekind value with FromStr. Only the exact strings "gc_cutoff" and "branch" are recognized; any other value bails before any drawing happens. The match is case-sensitive and has no aliases.

Source

Thrown at pageserver/ctl/src/draw_timeline_dir.rs:133

}

impl From<LineKind> for Fill {
    fn from(value: LineKind) -> Self {
        match value {
            LineKind::GcCutoff => Fill::Color(rgb(255, 0, 0)),
            LineKind::Branch => Fill::Color(rgb(0, 255, 0)),
        }
    }
}

impl FromStr for LineKind {
    type Err = anyhow::Error;

    fn from_str(s: &str) -> std::prelude::v1::Result<Self, Self::Err> {
        Ok(match s {
            "gc_cutoff" => LineKind::GcCutoff,
            "branch" => LineKind::Branch,
            _ => anyhow::bail!("unsupported linekind: {s}"),
        })
    }
}

pub fn main() -> Result<()> {
    // Parse layer filenames from stdin
    struct Layer {
        filename: String,
        key_range: Range<Key>,
        lsn_range: Range<Lsn>,
    }
    let mut files: Vec<Layer> = vec![];
    let stdin = io::stdin();

    let mut lines: Vec<(Lsn, LineKind)> = vec![];

    for (lineno, line) in stdin.lock().lines().enumerate() {
        let lineno = lineno + 1;

View on GitHub (pinned to 8f60b04da4)

Solutions

  1. Use exactly gc_cutoff or branch, lowercase with an underscore.
  2. Run the subcommand with --help to list the accepted values for your ctl build.

Example fix

# before
pageserver_ctl draw-timeline-dir --linekind gc-horizon ...

# after
pageserver_ctl draw-timeline-dir --linekind gc_cutoff ...
Defensive patterns

Strategy: validation

Validate before calling

// validate before the call
anyhow::ensure!(
    matches!(linekind.as_str(), "gc_cutoff" | "branch"),
    "linekind must be gc_cutoff or branch, got {linekind}"
);

Type guard

fn is_supported_linekind(s: &str) -> bool {
    matches!(s, "gc_cutoff" | "branch")
}

Prevention

When it happens

Trigger: Passing --linekind gc-horizon, --linekind GC_CUTOFF, or any other spelling than the two accepted literals.

Common situations: Guessing flag values without --help; renamed variants between ctl versions; shell completion inserting the wrong token.

Related errors


AI-assisted analysis of neondatabase/neon@8f60b04da4 (2026-08-16). Data as JSON: /api/errors/0d126ef981424865. Report an issue: GitHub.