{"record":{"id":"55e277164792c085","repo":"dbt-labs/dbt-core","slug":"table-rename-row-names-must-be-a-map-or-an-array","errorCode":null,"errorMessage":"Table.rename: row_names must be a map or an array","messagePattern":"Table\\.rename: row_names must be a map or an array","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-agate/src/table.rs","lineNumber":747,"sourceCode":"                                    renamed.append_value(old_name);\n                                }\n                            } else {\n                                renamed.append_null();\n                            }\n                        }\n                        Arc::new(renamed.finish())\n                    }};\n                }\n                if let Some(map) = v.downcast_object_ref::<ValueMap>() {\n                    Ok(rename_rows_by_map!(map))\n                } else if let Some(map) = v.downcast_object_ref::<MutableMap>() {\n                    Ok(rename_rows_by_map!(map))\n                } else {\n                    // Try to treat it as a generic iterable\n                    let iter = match v.try_iter() {\n                        Ok(iter) => iter,\n                        Err(_) => {\n                            return Err(Error::new(\n                                ErrorKind::InvalidArgument,\n                                \"Table.rename: row_names must be a map or an array\",\n                            ));\n                        }\n                    };\n\n                    // Collect the iterator values\n                    let values: Vec<_> = iter.collect();\n\n                    for i in 0..self.num_rows() {\n                        if let Some(value) = values.get(i) {\n                            if let Some(s) = value.as_str() {\n                                renamed.append_value(s);\n                            } else {\n                                return Err(Error::new(\n                                    ErrorKind::InvalidArgument,\n                                    format!(\n                                        \"Table.rename: row_names array must contain only strings, found: {}\",","sourceCodeStart":729,"sourceCodeEnd":765,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-agate/src/table.rs#L729-L765","documentation":"Table.rename was called with a row_names argument that is neither a map (old row-name -> new row-name) nor an array of new row names. Like the column_names case, the value is probed for iteration and this error is thrown if it cannot be iterated.","triggerScenarios":"Calling table.rename with row_names set to a scalar, integer, or non-iterable object, e.g. passing a single row name string instead of a list of names.","commonSituations":"Porting Python agate code that used a dict for row_names; passing a single value when a sequence was expected; config values parsed as the wrong type.","solutions":["Pass row_names as a map of old row name to new row name.","Pass row_names as an array of new row name strings, one per row.","Omit row_names if you only intend to rename columns."],"exampleFix":"// before\ntable.rename(None, Some(\"row0\"), false, false)\n// after\ntable.rename(None, Some(vec![\"row0\"]), false, false)","handlingStrategy":"validation","validationCode":"fn valid_row_names(v: &Value) -> bool {\n    v.as_map().is_some()\n        || v.as_array().map_or(false, |a| a.iter().all(|x| x.as_str().is_some()))\n}","typeGuard":"fn is_row_name_spec(v: &Value) -> bool {\n    v.as_map().is_some()\n        || v.as_array().map_or(false, |a| a.iter().all(|x| x.as_str().is_some()))\n}","tryCatchPattern":"match table.rename(None, row_names, false, false) {\n    Ok(t) => t,\n    Err(e) if e.to_string().contains(\"row_names must be a map or an array\") => {\n        eprintln!(\"row_names must be a map or array of strings: {e}\");\n        table.rename(None, None, false, false)?\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Always pass a map or a Vec<String> for row_names.","Don't pass a single row name string; wrap it in a vec.","Convert dict-based row_names from ported Python agate code to the map form."],"tags":["argument-validation","rename","agate"],"backgroundTag":"invalid-argument-format","analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}