{"record":{"id":"5ee116c365f177e0","repo":"affaan-m/ECC","slug":"unknown-panel-selectedpanel-valid-panels-a","errorCode":null,"errorMessage":"Unknown panel: ${selectedPanel}. Valid panels: ${Array.from(VALID_PANELS).join(', ')}","messagePattern":"Unknown panel: (.+?)\\. Valid panels: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/lib/skill-evolution/dashboard.js","lineNumber":353,"sourceCode":"    throw new Error(`Invalid now timestamp: ${now}`);\n  }\n\n  const dashboardOptions = { ...options, now };\n  const records = tracker.readSkillExecutionRecords(dashboardOptions);\n  const skillsById = health.discoverSkills(dashboardOptions);\n  const report = health.collectSkillHealth(dashboardOptions);\n  const summary = health.summarizeHealthReport(report);\n\n  const panelRenderers = {\n    'success-rate': () => renderSuccessRatePanel(records, report.skills, dashboardOptions),\n    'failures': () => renderFailureClusterPanel(records, dashboardOptions),\n    'amendments': () => renderAmendmentPanel(skillsById, dashboardOptions),\n    'versions': () => renderVersionTimelinePanel(skillsById, dashboardOptions),\n  };\n\n  const selectedPanel = options.panel || null;\n  if (selectedPanel && !VALID_PANELS.has(selectedPanel)) {\n    throw new Error(`Unknown panel: ${selectedPanel}. Valid panels: ${Array.from(VALID_PANELS).join(', ')}`);\n  }\n\n  const panels = {};\n  const textParts = [];\n\n  const header = [\n    'ECC Skill Health Dashboard',\n    `Generated: ${now}`,\n    `Skills: ${summary.total_skills} total, ${summary.healthy_skills} healthy, ${summary.declining_skills} declining`,\n    '',\n  ];\n\n  textParts.push(header.join('\\n'));\n\n  if (selectedPanel) {\n    const result = panelRenderers[selectedPanel]();\n    panels[selectedPanel] = result.data;\n    textParts.push(result.text);","sourceCodeStart":335,"sourceCodeEnd":371,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/lib/skill-evolution/dashboard.js#L335-L371","documentation":"renderDashboard renders one of a fixed set of panels (or all when no panel is given) validated against the VALID_PANELS set. When options.panel names a panel that is not in that set, the dashboard cannot know what to render and throws, listing all valid panel names.","triggerScenarios":"Calling renderDashboard({ panel: 'summary' }) when 'summary' is not in VALID_PANELS (valid ones include e.g. 'amendments', 'versions'); passing a CLI --panel flag with a typo or different casing ('Health' vs 'health'); passing panel names from an older version that were renamed or removed.","commonSituations":"Users typing panel names from memory in CLI invocations; scripts generated against an older library version where panels were renamed; case-sensitive matching breaking on user input like 'Overview'.","solutions":["Use a panel name exactly as listed in the error message (e.g. 'amendments', 'versions'), matching lowercase spelling.","Normalize user input before calling: options.panel = String(raw).trim().toLowerCase().","Omit options.panel to render the full dashboard with all panels.","If a needed panel is genuinely missing, update to a library version that includes it or add a panel renderer to VALID_PANELS."],"exampleFix":"// before\nrenderDashboard({ panel: 'Health' });\n\n// after\nconst valid = ['amendments', 'versions'];\nconst panel = String(process.argv[3] || '').trim().toLowerCase();\nrenderDashboard({ panel: valid.includes(panel) ? panel : undefined });","handlingStrategy":"validation","validationCode":"const VALID_PANELS = new Set(['amendments', 'versions']);\nconst panel = opts.panel ? String(opts.panel).trim().toLowerCase() : null;\nif (panel && !VALID_PANELS.has(panel)) throw new Error(`panel must be one of: ${[...VALID_PANELS].join(', ')}`);","typeGuard":"const isValidPanel = (p) => typeof p === 'string' && VALID_PANELS.has(p.trim().toLowerCase());","tryCatchPattern":"try {\n  return renderDashboard({ panel });\n} catch (err) {\n  if (err.message.startsWith('Unknown panel')) {\n    console.error(err.message); // includes valid panels list\n    return renderDashboard({});\n  }\n  throw err;\n}","preventionTips":["Expose the valid panel names as exported constants and build CLI help text from them.","Normalize panel input (trim + lowercase) before passing it on.","Omit the panel option when you want the full dashboard rather than guessing a name."],"tags":["validation","enum","dashboard","cli"],"backgroundTag":"invalid-enum-value","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}