{"record":{"id":"e2ce0fbb815e301c","repo":"affaan-m/ECC","slug":"an-install-component-id-is-required","errorCode":null,"errorMessage":"An install component ID is required","messagePattern":"An install component ID is required","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/lib/install-manifests.js","lineNumber":424,"sourceCode":"\n      return {\n        id: component.id,\n        family: component.family,\n        description: component.description,\n        moduleIds,\n        moduleCount: moduleIds.length,\n        targets,\n      };\n    })\n    .filter(component => !target || component.targets.includes(target));\n}\n\nfunction getInstallComponent(componentId, options = {}) {\n  const manifests = loadInstallManifests(options);\n  const normalizedComponentId = String(componentId || '').trim();\n\n  if (!normalizedComponentId) {\n    throw new Error('An install component ID is required');\n  }\n\n  const component = manifests.componentsById.get(normalizedComponentId);\n  if (!component) {\n    throw new Error(`Unknown install component: ${normalizedComponentId}`);\n  }\n\n  const moduleIds = dedupeStrings(component.modules);\n  const modules = moduleIds\n    .map(moduleId => manifests.modulesById.get(moduleId))\n    .filter(Boolean)\n    .map(module => ({\n      id: module.id,\n      kind: module.kind,\n      description: module.description,\n      targets: module.targets,\n      defaultInstall: module.defaultInstall,\n      cost: module.cost,","sourceCodeStart":406,"sourceCodeEnd":442,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/lib/install-manifests.js#L406-L442","documentation":"getInstallComponent() requires a non-empty component ID. It normalizes the argument with String(componentId || '').trim() and throws when the result is empty, because looking up nothing would otherwise be an ambiguous no-op.","triggerScenarios":"Calling getInstallComponent(undefined), getInstallComponent(''), getInstallComponent('   '), or getInstallComponent(null) — typically when an ID variable is unset, an array destructuring missed, or a CLI arg was not provided.","commonSituations":"A shell variable expanding to empty, a script reading an ID from a JSON field that is missing, or a CLI invocation like `ecc component` without the ID argument.","solutions":["Pass a concrete, non-empty component ID string","Trim/validate the ID before calling; skip the call entirely when it is empty","If the ID comes from a file or CLI arg, check it is present and fail early with a clearer message","Use listInstallComponents() to discover valid IDs first"],"exampleFix":"// before\nconst id = process.argv[2];\ngetInstallComponent(id); // throws when no arg\n// after\nconst id = process.argv[2];\nif (!id || !id.trim()) {\n  throw new Error('Usage: ecc component <component-id>');\n}\ngetInstallComponent(id.trim());","handlingStrategy":"validation","validationCode":"if (typeof componentId !== 'string' || !componentId.trim()) {\n  throw new Error('componentId must be a non-empty string');\n}","typeGuard":"const hasComponentId = (id) => typeof id === 'string' && id.trim().length > 0;","tryCatchPattern":"try {\n  const comp = getInstallComponent(componentId);\n} catch (err) {\n  if (err.message === 'An install component ID is required') {\n    console.error('Usage: <tool> component <component-id>');\n    process.exitCode = 1;\n  } else throw err;\n}","preventionTips":["Always guard CLI args before calling (process.argv length checks)","Trim inputs; whitespace-only strings are rejected too","Fail early at the boundary where the ID is read, with a usage message","Use listInstallComponents() to pick valid IDs when unsure"],"tags":["validation","missing-argument","install-manifests"],"backgroundTag":"missing-required-argument","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"}