affaan-m/ECC · error · Error

Invalid installState identity: expected targetId and targetR

Error message

Invalid installState identity: expected targetId and targetRoot

What it means

Generic guard inside normalizeInstallStateIdentity: the installState identity object itself is missing or not an object, so neither targetId nor targetRoot can be read. Every persisted install state must be keyed by both identifiers.

Source

Thrown at scripts/lib/state-store/queries.js:353

function normalizeInstallStateInput(installState) {
  return {
    targetId: installState.targetId,
    targetRoot: installState.targetRoot,
    profile: installState.profile ?? null,
    modules: installState.modules === undefined || installState.modules === null
      ? []
      : installState.modules,
    operations: installState.operations === undefined || installState.operations === null
      ? []
      : installState.operations,
    installedAt: installState.installedAt || new Date().toISOString(),
    sourceVersion: installState.sourceVersion ?? null,
  };
}

function normalizeInstallStateIdentity(identity) {
  if (!identity || typeof identity !== 'object') {
    throw new Error('Invalid installState identity: expected targetId and targetRoot');
  }

  const targetId = identity.targetId;
  const targetRoot = identity.targetRoot;
  if (typeof targetId !== 'string' || targetId.length === 0) {
    throw new Error('Invalid installState identity: targetId must be a non-empty string');
  }
  if (typeof targetRoot !== 'string' || targetRoot.length === 0) {
    throw new Error('Invalid installState identity: targetRoot must be a non-empty string');
  }

  return { targetId, targetRoot };
}

function normalizeGovernanceEventInput(governanceEvent) {
  return {
    id: governanceEvent.id,
    sessionId: governanceEvent.sessionId ?? null,

View on GitHub (pinned to 06c5e118c4)

Solutions

  1. Provide a value that satisfies the validation: Invalid installState identity: expected targetId and targetRoot
  2. Check the calling command or configuration for the reported field and correct it, then retry.
  3. Run the command with --help to review the expected input shape and allowed values.

Example fix

Correct the invalid input so that the following holds: Invalid installState identity: expected targetId and targetRoot
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at scripts/lib/state-store/queries.js:353 when the library encounters an invalid state.

Common situations: Raised when input validation fails because: Invalid installState identity: expected targetId and targetRoot. Typically caused by a missing, malformed, or out-of-range argument or configuration value.


AI-assisted analysis of affaan-m/ECC@06c5e118c4 (2026-08-18). Data as JSON: /api/errors/87c35b46f84c6220. Report an issue: GitHub.