{"record":{"id":"4f186637d8ca9d9b","repo":"influxdata/influxdb","slug":"non-identical-consecutive-keys","errorCode":null,"errorMessage":"non-identical consecutive keys","messagePattern":"non-identical consecutive keys","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"core/partition/src/lib.rs","lineNumber":1706,"sourceCode":"            // Generate a single time-based partitioning template with a\n            // randomised format string.\n            let template = vec![\n                TemplatePart::TimeFormat(&fmt),\n            ];\n            let template = test_table_partition_override(template);\n\n            // Timestamp: 2023-05-29T13:03:16Z\n            writer\n                .write_time(\"time\", vec![1685365396931384064].into_iter())\n                .unwrap();\n\n            writer\n                .write_tag(\"bananas\", Some(&[0b00000001]), vec![\"great\"].into_iter())\n                .unwrap();\n\n            writer.commit();\n            let ret = partition_keys(&batch, template.parts())\n                .map(|v| v.expect(\"non-identical consecutive keys\"))\n                .collect::<Result<Vec<_>, _>>();\n\n            // The is allowed to succeed or fail under this test (but not\n            // panic), and the returned error/value must match certain\n            // properties:\n            match ret {\n                Ok(v) => { assert_eq!(v.len(), 1); },\n                Err(e) => { assert_matches!(e, PartitionKeyError::InvalidStrftime); },\n            }\n        }\n\n        // Drives the strftime formatter through the \"front door\", using the\n        // same interface as a user would call to partition data. This validates\n        // the integration between the various formatters, range encoders,\n        // dedupe, etc.\n        #[test]\n        fn prop_strftime_integration(\n            times in arbitrary_timestamps(),","sourceCodeStart":1688,"sourceCodeEnd":1724,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/partition/src/lib.rs#L1688-L1724","documentation":"A test expect message used with Result::expect while collecting results from partition_keys in a test where consecutive keys must be either all identical or the operation errors cleanly. The panic means partition_keys returned an Err in a context where the test did not permit it.","triggerScenarios":"Calling partition_keys on a batch/template combination where a template part fails to render (returns PartitionKeyError) — e.g. invalid strftime spec or missing tag column — inside the test path that writes tags 'bananas' and computes keys.","commonSituations":"Template parts referencing tag columns absent from the batch; strftime specs the formatter cannot render; running modified template code against the fixed fixture.","solutions":["Inspect the underlying PartitionKeyError (unwrap the Result fully) to see which part failed","Fix the template so all parts resolve against the batch's schema and time column","Adjust the test if the failure is actually the expected outcome (the test allows success or clean failure, not Err here)"],"exampleFix":"// before\nlet ret = partition_keys(&batch, template.parts())\n    .map(|v| v.expect(\"non-identical consecutive keys\"))\n    .collect::<Result<Vec<_>, _>>();\n// after\nlet ret = partition_keys(&batch, template.parts())\n    .collect::<Result<Vec<_>, _>>()\n    .map_err(|e| anyhow!(\"partition_keys failed: {e}\"));","handlingStrategy":"validation","validationCode":"for part in template.parts() {\n    if let TemplatePart::TagColumn(name) = part {\n        assert!(batch.schema().column_with_name(name).is_some(), \"template tag column '{name}' not in batch\");\n    }\n}","typeGuard":null,"tryCatchPattern":"// surface the real error instead of expect()\nlet ret = partition_keys(&batch, template.parts())\n    .collect::<Result<Vec<_>, _>>()\n    .map_err(|e| e2e!(source: e, \"partition_keys failed\"));","preventionTips":["Ensure every template part resolves against the batch schema","Validate strftime specs against the supported formatter set","Preserve the underlying PartitionKeyError rather than masking it with expect()"],"tags":["rust","panic","test-assertion","partitioning"],"backgroundTag":"internal-invariant-violation","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}