{"record":{"id":"36e6b4222c0f1084","repo":"affaan-m/ECC","slug":"unknown-argument-arg-36e6b4","errorCode":null,"errorMessage":"Unknown argument: ${arg}","messagePattern":"Unknown argument: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/catalog.js","lineNumber":92,"sourceCode":"      parsed.help = true;\n    } else if (arg === '--json') {\n      parsed.json = true;\n    } else if (arg === '--family') {\n      if (!args[index + 1]) {\n        throw new Error('Missing value for --family');\n      }\n      parsed.family = normalizeFamily(args[index + 1]);\n      index += 1;\n    } else if (arg === '--target') {\n      if (!args[index + 1]) {\n        throw new Error('Missing value for --target');\n      }\n      parsed.target = args[index + 1];\n      index += 1;\n    } else if (parsed.command === 'show' && !parsed.componentId) {\n      parsed.componentId = arg;\n    } else {\n      throw new Error(`Unknown argument: ${arg}`);\n    }\n  }\n\n  return parsed;\n}\n\nfunction printProfiles(profiles) {\n  console.log('Install profiles:\\n');\n  for (const profile of profiles) {\n    console.log(`- ${profile.id} (${profile.moduleCount} modules)`);\n    console.log(`  ${profile.description}`);\n  }\n}\n\nfunction printComponents(components) {\n  console.log('Install components:\\n');\n  for (const component of components) {\n    console.log(`- ${component.id} [${component.family}]`);","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/catalog.js#L74-L110","documentation":"After confirming the URL scheme is https, _validate_import_url() requires a non-empty hostname. This catches malformed URLs that have a scheme but no host — e.g. 'https:///path' or 'https://:443/x'. Without a hostname the subsequent DNS resolution and connection would fail confusingly, so the validator fails fast with a clear message.","triggerScenarios":"Passing 'https:///instinct.md' (triple slash, no host); 'https://:443/file' (port but no host); a URL constructed by string concatenation that dropped the hostname segment.","commonSituations":"A templating/string-building bug omitted the host; a config field for the host was empty and was concatenated into the URL; copy-paste error.","solutions":["Include a valid hostname in the URL: 'https://example.com/instinct.md'.","If building the URL from parts, validate each component (host non-empty) before assembling.","Use urllib.parse.urlunparse with a populated netloc rather than manual string concatenation."],"exampleFix":"# before\nurl = f'https:///{path}'  # host dropped\n_validate_import_url(url)\n\n# after\nimport urllib.parse\nurl = urllib.parse.urlunparse(('https', 'example.com', f'/{path}', '', '', ''))\n_validate_import_url(url)","handlingStrategy":"validation","validationCode":"# Require a non-empty hostname before validating.\nimport urllib.parse\nparsed = urllib.parse.urlparse(source)\nif not parsed.hostname:\n    raise SystemExit(f'URL is missing a hostname: {source!r}')","typeGuard":"import urllib.parse\n\ndef url_has_host(s) -> bool:\n    return bool(urllib.parse.urlparse(s).hostname)","tryCatchPattern":null,"preventionTips":["Build URLs with urllib.parse.urlunparse from validated components rather than string concatenation.","Reject empty hostnames at the config/input boundary."],"tags":["validation","network","url","input"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}