affaan-m/ECC · error

Nasiko uninstall requires explicit --yes consent.

Error message

Nasiko uninstall requires explicit --yes consent.

What it means

uninstallNasiko is a destructive operation (removes the Nasiko binary and its receipt), so it demands explicit --yes consent (options.yes === true). Without it, the function throws before touching the filesystem, even if the binary exists.

Solutions

  1. Pass { yes: true } (or the --yes CLI flag) to uninstallNasiko to confirm removal.
  2. Run with { dryRun: true } first to inspect the plan, then re-run with --yes.
  3. Add --yes to your automation script for non-interactive environments (CI), acknowledging the deletion.
  4. Guard the call behind an interactive prompt in your wrapper tool before forwarding --yes.

Example fix

// before
await uninstallNasiko({ version: 'v0.1.0' }); // throws
// after
await uninstallNasiko({ version: 'v0.1.0', yes: true });
Defensive patterns

Strategy: validation

Validate before calling

function assertUninstallConsent(options) {
  if (!options.dryRun && options.yes !== true) {
    throw new Error('uninstall requires --yes');
  }
}

Type guard

function hasConsent(options) {
  return typeof options === 'object' && options !== null && options.yes === true;
}

Try / catch

try {
  await uninstallNasiko({ version, yes: true });
} catch (e) {
  if (e.message.includes('explicit --yes consent')) {
    console.error('Re-run with --yes to confirm removal');
  } else throw e;
}

Prevention

When it happens

Trigger: Calling uninstallNasiko({ ... }) without options.yes set and without options.dryRun. Any programmatic or CLI invocation lacking the consent flag.

Common situations: Scripts automating Nasiko cleanup that forgot the --yes flag; CI jobs calling the uninstall API; users running the uninstall command non-interactively.

Understand the failure class

Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/4a79f2f5085e55df. Report an issue: GitHub.

Appendix: source

Thrown at scripts/lib/nasiko-release.js:435

    const metadata = { version, platform: release.os, architecture: release.arch, manifestDigest: release.manifestDigest, artifactDigest: layer.digest, binaryDigest: release.binaryDigest, installedPath: destination, license: release.license, sourceUrl: release.sourceUrl };
    (dependencies.writeMetadata || writeMetadataExclusive)(metadataPath, metadata);
    metadataOwned = true;
    return { ...plan, dryRun: false, installed: true, reused: false, artifactDigest: layer.digest };
  } catch (error) {
    if (metadataOwned) fs.rmSync(metadataPath, { force: true });
    if (destinationOwned) fs.rmSync(destination, { force: true });
    throw error;
  } finally { releaseLock(); }
}

function uninstallNasiko(options = {}, dependencies = {}) {
  const version = options.version || 'v0.1.0';
  const release = getQualifiedRelease(version, dependencies.platform || process.platform, dependencies.arch || process.arch);
  const installDirectory = validateInstallDirectory(options.installDir || defaultInstallDirectory(release, dependencies.environment || process.env, dependencies.homeDirectory || os.homedir()));
  const destination = path.join(installDirectory, release.binaryName);
  const plan = { dryRun: Boolean(options.dryRun), version, destination };
  if (options.dryRun) return plan;
  if (!options.yes) throw new Error('Nasiko uninstall requires explicit --yes consent.');
  if (!fs.existsSync(installDirectory)) return { ...plan, dryRun: false, removed: false };
  assertPrivateInstallDirectory(installDirectory);
  const releaseLock = acquireLifecycleLock(installDirectory);
  const metadataPath = metadataPathFor(destination);
  const suffix = `${process.pid}-${crypto.randomBytes(6).toString('hex')}`;
  const binaryTombstone = `${destination}.remove-${suffix}`;
  const metadataTombstone = `${metadataPath}.remove-${suffix}`;
  let binaryStaged = false;
  let metadataStaged = false;
  const rename = dependencies.rename || fs.renameSync;
  const remove = dependencies.remove || (target => fs.rmSync(target));
  try {
    const status = (dependencies.inspectInstalled || inspectInstalledNasiko)(destination);
    if (!status.installed) return { ...plan, dryRun: false, removed: false };
    if (!status.qualified || status.version !== version) throw new Error('Refusing to remove an unqualified or modified Nasiko executable.');
    rename(destination, binaryTombstone);
    binaryStaged = true;
    rename(metadataPath, metadataTombstone);

View on GitHub (pinned to 8321021c54)