affaan-m/ECC · error · Error

Refusing to run install from untrusted repo root ${normalize

Error message

Refusing to run install from untrusted repo root ${normalized}: package.json name '${pkgName}' is not an official ECC package.

What it means

aura_verdict() is the only function in the AURA adapter that raises — and it raises ValueError solely for a malformed DID argument. The DID must be a non-empty string starting with the literal prefix 'did:'. This is treated as a caller bug, deliberately distinct from network/parse failures which return an `unknown` verdict instead of raising. All other errors (HTTP, DNS, malformed JSON, unexpected shape) are swallowed into a verdict.

Source

Thrown at scripts/auto-update.js:150

  const packageJsonPath = path.join(normalized, 'package.json');
  const installApplyPath = path.join(normalized, 'scripts', 'install-apply.js');

  if (!fs.existsSync(packageJsonPath)) {
    throw new Error(`Invalid ECC repo root: missing package.json at ${packageJsonPath}`);
  }

  if (!fs.existsSync(installApplyPath)) {
    throw new Error(`Invalid ECC repo root: missing install script at ${installApplyPath}`);
  }

  let pkgName = null;
  try {
    pkgName = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')).name;
  } catch {
    throw new Error(`Invalid ECC repo root: unreadable package.json at ${packageJsonPath}`);
  }
  if (!ECC_PACKAGE_NAMES.has(pkgName)) {
    throw new Error(`Refusing to run install from untrusted repo root ${normalized}: package.json name '${pkgName}' is not an official ECC package.`);
  }

  return normalized;
}

function runExternalCommand(command, args, options = {}) {
  const result = spawnSync(command, args, {
    cwd: options.cwd,
    env: options.env || process.env,
    encoding: 'utf8',
    maxBuffer: 10 * 1024 * 1024
  });

  if (result.error) {
    throw result.error;
  }

  if (typeof result.status === 'number' && result.status !== 0) {

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Ensure the DID string starts with 'did:' — e.g. 'did:aura:z6Mk...' or 'did:key:z6Mk...'.
  2. Validate the DID before calling: if not did or not str(did).startswith('did:'): handle gracefully.
  3. Check that you are passing the counterparty DID from the correct field in your payload.

Example fix

# before
v = aura_verdid(raw_key)  # raw_key = 'z6Mk...' -> ValueError

# after
did = f'did:key:{raw_key}' if not raw_key.startswith('did:') else raw_key
v = aura_verdict(did)
Defensive patterns

Strategy: validation

Validate before calling

# Validate the DID shape before calling aura_verdict.
def is_valid_did(did):
    return isinstance(did, str) and did.startswith('did:') and len(did) > 4

if not is_valid_did(counterparty_did):
    raise ValueError(f'counterparty DID is malformed: {counterparty_did!r}')
v = aura_verdict(counterparty_did)

Type guard

def is_valid_did(did) -> bool:
    return isinstance(did, str) and did.startswith('did:') and len(did) > 4

Try / catch

try:
    v = aura_verdict(did)
except ValueError:
    # This only fires for a malformed DID — a caller bug, not a network issue.
    log.error('refusing to check trust: DID argument is malformed')
    raise

Prevention

When it happens

Trigger: Calling aura_verdict('') (empty); aura_verdict(None); aura_verdict('z6Mk...') (raw multibase key with no did: method prefix); aura_verdict(123) (non-string).

Common situations: The DID variable was never populated from the request context; the wrong variable was passed (e.g. a raw key instead of a DID); a counterparty identifier field uses a different format than expected.

Related errors


AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13). Data as JSON: /api/errors/bada7d71c9cd9457. Report an issue: GitHub.