{"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":"Error","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/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/harness-adapter-compliance.js#L42-L78","documentation":"After parsing, parseArgs validates parsed.format against the allowlist ['text','json','markdown'] and throws `Invalid format: <value>. Use text, json, or markdown.` for anything else. The format flag controls report output style and is constrained to these three values.","triggerScenarios":"Passing --format=yaml, --format=TEXT (uppercase), or an empty --format=; programmatically setting parsed.format to a value from another tool's vocabulary.","commonSituations":"Copy-pasting flags from a different script that supports more formats; case-sensitivity surprises (XML/TEXT); shell defaults emitting an empty string; typos like 'md' instead of 'markdown'.","solutions":["Use one of the exact values: text, json, or markdown (lowercase).","Replace abbreviations like md with markdown.","Check the shell/config for an empty or whitespace --format= value and remove it.","Normalize case before invoking if the value comes from an env var: `--format=$(echo \"$FMT\" | tr 'A-Z' 'a-z')`."],"exampleFix":"// before\nnode scripts/harness-adapter-compliance.js --format=md\n\n// after\nnode scripts/harness-adapter-compliance.js --format=markdown","handlingStrategy":"validation","validationCode":"const FORMATS = ['text', 'json', 'markdown'];\nif (!FORMATS.includes(parsed.format)) {\n  throw new Error(`Invalid format: ${parsed.format}. Use text, json, or markdown.`);\n}","typeGuard":"const isFormat = (f) => f === 'text' || f === 'json' || f === 'markdown';","tryCatchPattern":"try {\n  const parsed = parseArgs(process.argv);\n} catch (e) {\n  if (e.message.startsWith('Invalid format:')) {\n    console.error(e.message);\n    process.exit(2);\n  }\n  throw e;\n}","preventionTips":["Use the exact lowercase values: text, json, markdown — no abbreviations like md.","Lowercase env-sourced values before passing them: ${FMT,,} in bash.","Guard against empty --format= values in generated command lines.","Define the format constant once and reuse it in wrappers."],"tags":["cli","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"}