{"record":{"id":"1862f5df3091fae8","repo":"eyaltoledano/claude-task-master","slug":"format-must-be-a-string","errorCode":null,"errorMessage":"Format must be a string","messagePattern":"Format must be a string","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/progress/tracker-ui.js","lineNumber":19,"sourceCode":"import chalk from 'chalk';\n\n/**\n * Factory for creating progress bar elements\n */\nclass ProgressBarFactory {\n\tconstructor(multibar) {\n\t\tif (!multibar) {\n\t\t\tthrow new Error('Multibar instance is required');\n\t\t}\n\t\tthis.multibar = multibar;\n\t}\n\n\t/**\n\t * Creates a progress bar with the given format\n\t */\n\tcreateBar(format, payload = {}) {\n\t\tif (typeof format !== 'string') {\n\t\t\tthrow new Error('Format must be a string');\n\t\t}\n\n\t\tconst bar = this.multibar.create(\n\t\t\t1, // total\n\t\t\t1, // current\n\t\t\t{},\n\t\t\t{\n\t\t\t\tformat,\n\t\t\t\tbarsize: 1,\n\t\t\t\thideCursor: true,\n\t\t\t\tclearOnComplete: false\n\t\t\t}\n\t\t);\n\n\t\tbar.update(1, payload);\n\t\treturn bar;\n\t}\n","sourceCodeStart":1,"sourceCodeEnd":37,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/src/progress/tracker-ui.js#L1-L37","documentation":"ProgressBarFactory.createBar() validates that the bar format is a string before handing it to multibar.create, since cli-progress formats are template strings. Non-string formats (undefined, objects) would silently corrupt rendering, so it throws immediately.","triggerScenarios":"factory.createBar(undefined) or createBar(someObject) — e.g. a format constant not imported/defined, or a config value that isn't a string; called internally by createHeader, createRow, and createBorder.","commonSituations":"Missing import of a format constant (undefined passed through), building format strings dynamically and getting non-string results, renamed/removed format helpers after a version upgrade.","solutions":["Pass a string format, e.g. createBar('{bar} {percentage}%').","Check that any format constant you reference is actually imported and defined.","Coerce/validate dynamic formats: typeof fmt === 'string' ? fmt : DEFAULT_FORMAT.","Trace whether createHeader/createRow/createBorder received a bad argument upstream."],"exampleFix":"// before\n// factory.createBar(SOME_FORMAT) // SOME_FORMAT undefined\n// after\n// import { SOME_FORMAT } from './formats.js'; // ensure defined\n// factory.createBar(SOME_FORMAT || '{bar} {percentage}%');","handlingStrategy":"type-guard","validationCode":"function safeCreateBar(factory, format, payload) {\n  const fmt = typeof format === 'string' && format.length ? format : '{bar} {percentage}% | {value}/{total}';\n  return factory.createBar(fmt, payload);\n}","typeGuard":"function isBarFormat(f) {\n  return typeof f === 'string' && f.length > 0;\n}","tryCatchPattern":"try {\n  factory.createBar(format);\n} catch (e) {\n  if (e.message === 'Format must be a string') {\n    return factory.createBar(DEFAULT_BAR_FORMAT);\n  }\n  throw e;\n}","preventionTips":["Verify format constants are imported and defined before use","Coerce dynamic format values with String() or fallback defaults","Use named exports for formats and lint for unused/undefined identifiers","Add unit checks that header/row/border helpers receive string formats"],"tags":["validation","argument-type","progress-bar","format"],"backgroundTag":"invalid-argument-type","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}