{"record":{"id":"ac9684c9c76e331e","repo":"affaan-m/ECC","slug":"invalid-format-parsed-format-use-text-json-ac9684","errorCode":null,"errorMessage":"Invalid format: ${parsed.format}. Use text, json, or markdown.","messagePattern":"Invalid format: (.+?)\\. Use text, json, or markdown\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/harness-adapter-compliance.js","lineNumber":60,"sourceCode":"      continue;\n    }\n\n    if (arg === '--root') {\n      parsed.root = path.resolve(args[index + 1] || process.cwd());\n      index += 1;\n      continue;\n    }\n\n    if (arg.startsWith('--root=')) {\n      parsed.root = path.resolve(arg.slice('--root='.length));\n      continue;\n    }\n\n    throw new Error(`Unknown argument: ${arg}`);\n  }\n\n  if (!['text', 'json', 'markdown'].includes(parsed.format)) {\n    throw new Error(`Invalid format: ${parsed.format}. Use text, json, or markdown.`);\n  }\n\n  parsed.root = path.resolve(parsed.root);\n  return parsed;\n}\n\nfunction printHelp() {\n  console.log([\n    'Usage: node scripts/harness-adapter-compliance.js [options]',\n    '',\n    'Validate or render the ECC harness adapter compliance scorecard.',\n    '',\n    'Options:',\n    '  --check                 Fail if adapter records or docs are out of sync',\n    '  --format <text|json|markdown>',\n    '  --root <path>           Repository root, defaults to cwd',\n    '  -h, --help              Show this help',\n  ].join('\\n'));","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/harness-adapter-compliance.js#L42-L78","documentation":"Thrown by the argument parser in scripts/harness-adapter-compliance.js when the --format flag receives a value that is not one of the three allowed formats: 'text', 'json', or 'markdown'. The check runs after all args are parsed and validates parsed.format against the whitelist.","triggerScenarios":"Running `node scripts/harness-adapter-compliance.js --format yaml`, `--format html`, `--format csv`, or any value outside {text, json, markdown}.","commonSituations":"Using a format from a different tool, a typo, or an abbreviated form like 'md' instead of 'markdown' or 'txt' instead of 'text'.","solutions":["Use one of: --format text, --format json, or --format markdown.","Use the convenience flags --text, --json, or --markdown if available.","Check for abbreviations: 'md' is not accepted, use 'markdown'."],"exampleFix":"// before\nnode scripts/harness-adapter-compliance.js --format md\n// after\nnode scripts/harness-adapter-compliance.js --format markdown","handlingStrategy":"validation","validationCode":"const VALID_FORMATS = ['text', 'json', 'markdown'];\nif (!VALID_FORMATS.includes(parsed.format.toLowerCase())) {\n  console.error(`Invalid format: ${parsed.format}. Use one of: ${VALID_FORMATS.join(', ')}`);\n  process.exit(1);\n}","typeGuard":"function isValidFormat(fmt) {\n  return ['text', 'json', 'markdown'].includes(fmt.toLowerCase());\n}","tryCatchPattern":null,"preventionTips":["Use the exact format names: text, json, markdown (not md, txt, or yml).","Validate format input from configuration files before passing to the CLI.","Add autocomplete that only offers valid format values."],"tags":["cli","argument-parsing","validation","format"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}