{"record":{"id":"6d53148f5e3f02f2","repo":"affaan-m/ECC","slug":"a-normalized-install-request-is-required","errorCode":null,"errorMessage":"A normalized install request is required","messagePattern":"A normalized install request is required","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/lib/install/runtime.js","lineNumber":11,"sourceCode":"'use strict';\n\nconst {\n  createLegacyCompatInstallPlan,\n  createLegacyInstallPlan,\n  createManifestInstallPlan,\n} = require('../install-executor');\n\nfunction createInstallPlanFromRequest(request, options = {}) {\n  if (!request || typeof request !== 'object') {\n    throw new Error('A normalized install request is required');\n  }\n\n  if (request.mode === 'manifest') {\n    return createManifestInstallPlan({\n      target: request.target,\n      profileId: request.profileId,\n      moduleIds: request.moduleIds,\n      includeComponentIds: request.includeComponentIds,\n      excludeComponentIds: request.excludeComponentIds,\n      projectRoot: options.projectRoot,\n      homeDir: options.homeDir,\n      sourceRoot: options.sourceRoot,\n    });\n  }\n\n  if (request.mode === 'legacy-compat') {\n    return createLegacyCompatInstallPlan({\n      target: request.target,","sourceCodeStart":1,"sourceCodeEnd":29,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/lib/install/runtime.js#L1-L29","documentation":"Thrown by createInstallPlanFromRequest() when the request argument is null, undefined, or not an object. The function expects a request that has already been normalized by normalizeInstallRequest(); passing raw CLI args, an array, or a primitive is a programming error.","triggerScenarios":"Calling createInstallPlanFromRequest(null), createInstallPlanFromRequest(undefined), createInstallPlanFromRequest('manifest'), or createInstallPlanFromRequest([request]) from a custom integration that bypasses normalizeInstallRequest().","commonSituations":"A wrapper script that forgets to call normalizeInstallRequest(); conditional code that passes request only in some branches; a refactor that changed the call site without updating the argument.","solutions":["Run the input through normalizeInstallRequest() first and pass its return value.","If you already normalized, check that the variable is not shadowed or reassigned to null before the call.","Add a type guard at the call site to fail earlier with a clearer message."],"exampleFix":"// before\nconst plan = createInstallPlanFromRequest(argv[2]);\n// after\nconst request = normalizeInstallRequest(parseInstallArgs(argv));\nconst plan = createInstallPlanFromRequest(request, { projectRoot });","handlingStrategy":"type-guard","validationCode":"function isNormalizedRequest(req) {\n  return Boolean(req)\n    && typeof req === 'object'\n    && !Array.isArray(req)\n    && ['manifest','legacy-compat','legacy'].includes(req.mode)\n    && typeof req.target === 'string';\n}\nif (!isNormalizedRequest(request)) {\n  throw new Error('createInstallPlanFromRequest requires output of normalizeInstallRequest().');\n}","typeGuard":"function isInstallRequest(value) {\n  return value != null\n    && typeof value === 'object'\n    && !Array.isArray(value)\n    && typeof value.mode === 'string'\n    && typeof value.target === 'string';\n}","tryCatchPattern":"try {\n  plan = createInstallPlanFromRequest(request, options);\n} catch (e) {\n  if (/normalized install request is required/.test(e.message)) {\n    request = normalizeInstallRequest(parseInstallArgs(process.argv));\n    plan = createInstallPlanFromRequest(request, options);\n  } else throw e;\n}","preventionTips":["Always pipe parseInstallArgs -> normalizeInstallRequest -> createInstallPlanFromRequest; never skip a stage.","Add a runtime type guard at module entry in integrations.","Unit-test the full pipeline so a null request is caught early."],"tags":["install","api-misuse","runtime","programming-error"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}