{"record":{"id":"2781d3723ff624da","repo":"risingwavelabs/risingwave","slug":"invalid-order-key-item-item","errorCode":null,"errorMessage":"Invalid order key item `{item}`","messagePattern":"Invalid order key item `(.+?)`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/connector/src/sink/iceberg/create_table.rs","lineNumber":492,"sourceCode":"    }\n    Ok(partition_columns)\n}\n\npub fn parse_order_key_exprs(\n    expr: String,\n) -> std::result::Result<Vec<IcebergOrderKeyField>, anyhow::Error> {\n    let mut order_keys = Vec::new();\n    let mut seen_columns = std::collections::HashSet::new();\n\n    for raw_item in expr.split(',') {\n        let item = raw_item.trim();\n        if item.is_empty() {\n            bail!(\"Invalid order key: empty item in `{expr}`\");\n        }\n\n        let tokens = item.split_whitespace().collect_vec();\n        if tokens.is_empty() {\n            bail!(\"Invalid order key item `{item}`\");\n        }\n        if tokens.len() > 4 {\n            bail!(\n                \"Invalid order key item `{item}`\\nHINT: Supported format is `column [asc|desc] [nulls first|last]`\"\n            );\n        }\n\n        let column = tokens[0];\n        if !ORDER_KEY_COLUMN_RE.is_match(column) {\n            bail!(\n                \"Invalid order key column `{column}`\\nHINT: Only plain column names are supported in order_key\"\n            );\n        }\n        if !seen_columns.insert(column.to_ascii_lowercase()) {\n            bail!(\"Duplicate column `{column}` in order_key\");\n        }\n\n        let mut direction = SortDirection::Ascending;","sourceCodeStart":474,"sourceCodeEnd":510,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/sink/iceberg/create_table.rs#L474-L510","documentation":"After trimming, an order key item must contain at least one whitespace-separated token (the column name). If split_whitespace yields nothing, the item consists only of whitespace (e.g. a comma followed by spaces). The error names the offending item so the developer can locate it in the order_key string.","triggerScenarios":"An order_key item that trims to non-empty but contains only spaces between commas, e.g. order_key='id,   ,name' — the middle item `   ` is not empty after trim? (trim removes spaces, so this hits 590); actually this branch is reachable for items of whitespace when split(',') boundaries differ, e.g. order_key='id , ' style strings in edge cases. Practically: any item with no token after tokenization.","commonSituations":"Whitespace-only placeholder left where a column name should be; template expansion producing blank items; mis-edited config where a column name was deleted but the comma kept.","solutions":["Replace the blank item with a real column name from the table","Remove the extra comma producing the blank item","Recount the items: order_key='a,b,c' must yield exactly the columns you intend","Quote the order_key value carefully so shell/SQL quoting does not eat a name"],"exampleFix":"// before\norder_key = 'user_id, , created_at'\n// after\norder_key = 'user_id, created_at'","handlingStrategy":"validation","validationCode":"for item in expr.split(',').map(|s| s.trim()) {\n    if item.split_whitespace().count() == 0 {\n        return Err(format!(\"order_key item `{item}` has no tokens; supply a column name\"));\n    }\n}","typeGuard":"fn order_key_item_is_blank(item: &str) -> bool {\n    !item.trim().is_empty() && item.split_whitespace().next().is_none()\n}","tryCatchPattern":null,"preventionTips":["Always place a real column name between commas in order_key","After editing configs, re-read the rendered order_key string, not the template","Avoid whitespace placeholders; delete an item entirely if it is not needed","Test the option parser with a unit test covering blank items"],"tags":["validation","iceberg","config","sql"],"backgroundTag":"invalid-argument-format","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}