{"record":{"id":"5140a22eff621afb","repo":"apache/superset","slug":"unknown-input-format","errorCode":null,"errorMessage":"Unknown input format","messagePattern":"Unknown input format","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/utilities.ts","lineNumber":1368,"sourceCode":"        },\n        format() {\n          return '';\n        },\n      }\n    );\n  }\n}\n\n// can handle arrays or jQuery selections of tables\nPivotData.forEachRecord = function (\n  input: unknown,\n  processRecord: (record: PivotRecord) => void,\n) {\n  if (Array.isArray(input)) {\n    // array of objects\n    return input.map(record => processRecord(record));\n  }\n  throw new Error(t('Unknown input format'));\n};\n\nPivotData.defaultProps = {\n  cols: [],\n  rows: [],\n  vals: [],\n  sorters: {},\n  rowOrder: 'key_a_to_z',\n  colOrder: 'key_a_to_z',\n};\n\nPivotData.propTypes = {\n  data: PropTypes.oneOfType([PropTypes.array, PropTypes.object, PropTypes.func])\n    .isRequired,\n  cols: PropTypes.arrayOf(PropTypes.string),\n  rows: PropTypes.arrayOf(PropTypes.string),\n  vals: PropTypes.arrayOf(PropTypes.string),\n  valueFilter: PropTypes.objectOf(PropTypes.objectOf(PropTypes.bool)),","sourceCodeStart":1350,"sourceCodeEnd":1386,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/utilities.ts#L1350-L1386","documentation":"Thrown by PivotData.forEachRecord in the pivot-table plugin's vendored react-pivottable utilities. Upstream pivottable accepts arrays, functions, or jQuery selections of tables as input, but this trimmed port only handles arrays of record objects; anything else is rejected before any record is processed. It is a fail-fast guard against an input contract violation, not a data problem.","triggerScenarios":"Calling PivotData.forEachRecord (directly or indirectly via PivotData construction / chart transformProps) with input that is not an Array — e.g. a generator, an iterable, a function returning records, a jQuery/DOM selection, or undefined/null data passed as the records argument.","commonSituations":"Custom forks or plugins that feed the pivot table with a non-array data source; upstream pivottable code copied over that passes a function; a data connector that returns a Map/stream instead of a plain array; tests that pass malformed query results.","solutions":["Convert your input to a plain array of record objects before passing it: Array.from(input) or [...input] for iterables; call the function yourself if input is a records-producing callback.","If you wrapped PivotData, verify the data argument reaches it unmodified (not a DOM/jQuery selection or undefined after an async fetch race).","Extend forEachRecord in your fork with the additional branches (function input, jQuery table) copied from upstream react-pivottable if you need them."],"exampleFix":"// before\nPivotData.forEachRecord(recordsIterable, processRecord); // throws\n\n// after\nPivotData.forEachRecord([...recordsIterable], processRecord);","handlingStrategy":"type-guard","validationCode":"if (!Array.isArray(input)) {\n  input = Array.isArray(input?.records) ? input.records : Array.from(input);\n}\nPivotData.forEachRecord(input, processRecord);","typeGuard":"const isRecordArray = (v: unknown): v is PivotRecord[] =>\n  Array.isArray(v) && v.every(r => r != null && typeof r === 'object');","tryCatchPattern":"try { PivotData.forEachRecord(data, cb); } catch (e) { if (e instanceof Error && e.message.includes('Unknown input format')) throw new TypeError('PivotData input must be an array of records'); throw e; }","preventionTips":["Always materialize data to a plain array before feeding PivotData","Do not port upstream jQuery/function input code paths against this vendored version"],"tags":["pivot-table","input-validation","data-format"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}