{"record":{"id":"517b3094656b5e52","repo":"dbt-labs/dbt-core","slug":"table-rename-row-names-array-must-contain-only-st","errorCode":null,"errorMessage":"Table.rename: row_names array must contain only strings, found: {}","messagePattern":"Table\\.rename: row_names array must contain only strings, found: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-agate/src/table.rs","lineNumber":762,"sourceCode":"                    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: {}\",\n                                        value\n                                    ),\n                                ));\n                            }\n                        } else {\n                            renamed.append_option(old_row_name(i));\n                        }\n                    }\n                    Ok(Arc::new(renamed.finish()))\n                }\n            })\n            .transpose()?;\n\n        self.rename(renamed_columns, renamed_rows, slug_columns, slug_rows)\n    }","sourceCodeStart":744,"sourceCodeEnd":780,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-agate/src/table.rs#L744-L780","documentation":"When row_names is given as an array to Table.rename, each element must be a string replacing the row's name positionally. A non-string element was encountered at some row index and the error reports the offending value.","triggerScenarios":"Calling table.rename with a row_names array containing integers, floats, nulls or nested values, e.g. [0, 1, 2].","commonSituations":"Auto-generating row names from numeric row indices without stringifying; loading row labels from a numeric column; JSON arrays where numbers were not quoted.","solutions":["Stringify every element of the row_names array before calling rename.","Only pass arrays whose elements are confirmed strings.","Use the map form of row_names if you only need to rename specific rows."],"exampleFix":"// before\nrename(None, Some(vec![0, 1, 2]), false, false)\n// after\nrename(None, Some(vec![\"0\", \"1\", \"2\"]), false, false)","handlingStrategy":"type-guard","validationCode":"let all_strings = row_names.iter().all(|v| v.as_str().is_some());\nif !all_strings { panic!(\"row_names must contain only strings\"); }","typeGuard":"fn all_row_strings(v: &[Value]) -> bool {\n    v.iter().all(|x| x.as_str().is_some())\n}","tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"row_names array must contain only strings\") => {\n        let coerced: Vec<String> = raw_rows.iter().map(|v| v.to_string()).collect();\n        table.rename(None, Some(coerced), false, false)?\n    }\n    other => other?,\n}","preventionTips":["Stringify numeric row labels before building the array.","Quote numbers when generating name lists from JSON.","Assert array element types in tests before calling rename."],"tags":["argument-validation","rename","type-error"],"backgroundTag":"invalid-argument-value","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"}