influxdata/influxdb · info

should render string

Error message

should render string

What it means

In test_never_empty, StrftimeFormatter::render(42, &mut buf).expect("should render string") panics if rendering a timestamp with an empty format string fails. The empty format must still render a non-empty placeholder ('^') so partition keys are never empty; an Err here means render returned std::fmt::Error.

Solutions

  1. Fix StrftimeFormatter::render so an empty format still writes the '^' placeholder
  2. Check the formatter's internal buffer/ring-cache path for early Err returns
  3. Run the adjacent tests (test_incomplete_formatter) to confirm formatter edge cases are handled
Defensive patterns

Strategy: try-catch

Try / catch

if fmt.render(42, &mut buf).is_err() {
    eprintln!("render failed for empty format; fallback placeholder not written");
}

Prevention

When it happens

Trigger: Calling StrftimeFormatter::new("").render(ts, &mut buf) and getting Err — i.e. the ring-buffer/strftime machinery failed to emit the fallback placeholder for the empty format.

Common situations: Only hit when changing the StrftimeFormatter implementation, e.g. breaking the empty-format fallback that renders '^'.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19). Data as JSON: /api/errors/7fddba9ed645880f. Report an issue: GitHub.

Appendix: source

Thrown at core/partition/src/template/strftime.rs:291

    use super::*;

    #[test]
    fn test_default_formatter() {
        let template = TablePartitionTemplateOverride::default();
        let expect = template.parts().collect::<Vec<_>>();

        // If this assert fails (and it probably shouldn't!) then you may want
        // to consider changing the special case optimisation above.
        assert_matches!(expect.as_slice(), &[TemplatePart::TimeFormat(YMD_SPEC)]);
    }

    #[test]
    fn test_never_empty() {
        let mut fmt = StrftimeFormatter::new("");

        let mut buf = String::new();
        fmt.render(42, &mut buf).expect("should render string");
        assert!(!buf.is_empty());
        assert_eq!(buf, "^");
    }

    #[test]
    fn test_incomplete_formatter() {
        let mut fmt = StrftimeFormatter::new("%");

        let mut buf = String::new();
        let got = fmt.render(42, &mut buf);
        assert_matches!(got, Err(PartitionKeyError::InvalidStrftime));
    }

    #[test]
    fn test_incomplete_formatter_removes_bad_mapping() {
        let mut fmt = StrftimeFormatter::new("%s");

        let mut buf = String::new();

View on GitHub (pinned to 06200ef96b)