{"record":{"id":"5b1e6ed584f9e43c","repo":"affaan-m/ECC","slug":"unknown-evolution-log-type-logtype","errorCode":null,"errorMessage":"Unknown evolution log type: ${logType}","messagePattern":"Unknown evolution log type: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/lib/skill-evolution/versioning.js","lineNumber":52,"sourceCode":"  const skillFilePath = getSkillFilePath(skillPath);\n  if (!fs.existsSync(skillFilePath)) {\n    throw new Error(`Skill file not found: ${skillFilePath}`);\n  }\n\n  return skillFilePath;\n}\n\nfunction getVersionsDir(skillPath) {\n  return path.join(normalizeSkillDir(skillPath), VERSION_DIRECTORY_NAME);\n}\n\nfunction getEvolutionDir(skillPath) {\n  return path.join(normalizeSkillDir(skillPath), EVOLUTION_DIRECTORY_NAME);\n}\n\nfunction getEvolutionLogPath(skillPath, logType) {\n  if (!EVOLUTION_LOG_TYPES.includes(logType)) {\n    throw new Error(`Unknown evolution log type: ${logType}`);\n  }\n\n  return path.join(getEvolutionDir(skillPath), `${logType}.jsonl`);\n}\n\nfunction ensureSkillVersioning(skillPath) {\n  ensureSkillExists(skillPath);\n\n  const versionsDir = getVersionsDir(skillPath);\n  const evolutionDir = getEvolutionDir(skillPath);\n\n  ensureDir(versionsDir);\n  ensureDir(evolutionDir);\n\n  for (const logType of EVOLUTION_LOG_TYPES) {\n    const logPath = getEvolutionLogPath(skillPath, logType);\n    if (!fs.existsSync(logPath)) {\n      fs.writeFileSync(logPath, '', 'utf8');","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/lib/skill-evolution/versioning.js#L34-L70","documentation":"getEvolutionLogPath validates the logType against the EVOLUTION_LOG_TYPES whitelist before building a jsonl path. Only recognized evolution log types may be used; anything else is rejected. This keeps log file names constrained to the set the tooling knows how to read and write.","triggerScenarios":"Calling getEvolutionLogPath, appendEvolutionRecord, or getEvolutionLog with a logType string not present in EVOLUTION_LOG_TYPES — e.g. a misspelled type, a custom type, or a type renamed in a newer version of the library.","commonSituations":"Hand-written scripts passing ad-hoc log names; renaming a log type in a library upgrade while old scripts still pass the old name; typos like 'evolotion' instead of the canonical type.","solutions":["Check the EVOLUTION_LOG_TYPES constant in scripts/lib/skill-evolution/versioning.js and pass exactly one of its members","Fix the spelling of the logType argument","If a genuinely new log type is needed, add it to EVOLUTION_LOG_TYPES in the library rather than passing an unlisted value","If this appeared after a library upgrade, migrate call sites to the renamed log types"],"exampleFix":"// before\ngetEvolutionLogPath(skillPath, 'changes'); // not a known type\n// after\ngetEvolutionLogPath(skillPath, 'history'); // a member of EVOLUTION_LOG_TYPES","handlingStrategy":"validation","validationCode":"const EVOLUTION_LOG_TYPES = ['history']; // mirror from versioning.js\nif (!EVOLUTION_LOG_TYPES.includes(logType)) {\n  throw new Error(`logType must be one of: ${EVOLUTION_LOG_TYPES.join(', ')}`);\n}","typeGuard":"function isValidLogType(t) {\n  return typeof t === 'string' && EVOLUTION_LOG_TYPES.includes(t);\n}","tryCatchPattern":"try {\n  return getEvolutionLog(skillPath, logType);\n} catch (err) {\n  if (err.message.startsWith('Unknown evolution log type')) {\n    console.error(`'${logType}' unsupported — check EVOLUTION_LOG_TYPES`);\n    return emptyLog;\n  } throw err;\n}","preventionTips":["Import or copy the EVOLUTION_LOG_TYPES constant instead of inlining strings","Keep logType values in a shared constant used by all call sites","Grep for logType literals after any library upgrade","Add a unit test per supported log type to catch renames"],"tags":["validation","enum"],"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"}