{"record":{"id":"65a87fb7f17f8af0","repo":"affaan-m/ECC","slug":"an-unqualified-or-incompatible-nasiko-executable-o","errorCode":null,"errorMessage":"An unqualified or incompatible Nasiko executable or receipt already exists at the destination.","messagePattern":"An unqualified or incompatible Nasiko executable or receipt already exists at the destination\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/lib/nasiko-release.js","lineNumber":398,"sourceCode":"  const version = options.version || 'v0.1.0';\n  const base = getQualifiedRelease(version, dependencies.platform || process.platform, dependencies.arch || process.arch);\n  const release = dependencies.releaseOverride ? { ...base, ...dependencies.releaseOverride } : base;\n  const installDirectory = validateInstallDirectory(options.installDir || defaultInstallDirectory(release, dependencies.environment || process.env, dependencies.homeDirectory || os.homedir()));\n  const destination = path.join(installDirectory, release.binaryName);\n  const plan = { dryRun: Boolean(options.dryRun), version, platform: release.os, architecture: release.arch, manifestDigest: release.manifestDigest, binaryDigest: release.binaryDigest, registryOrigin: REGISTRY_ORIGIN, destination, license: release.license, sourceUrl: release.sourceUrl };\n  if (options.dryRun) return plan;\n  if (!options.yes) throw new Error('Nasiko installation requires explicit --yes consent.');\n  fs.mkdirSync(installDirectory, { recursive: true, mode: 0o755 });\n  assertPrivateInstallDirectory(installDirectory);\n  const releaseLock = acquireLifecycleLock(installDirectory);\n  const metadataPath = metadataPathFor(destination);\n  let destinationOwned = false;\n  let metadataOwned = false;\n  try {\n    const existing = inspectInstalledNasiko(destination);\n    if (existing.installed) {\n      if (existing.qualified && existing.version === version) return { ...plan, dryRun: false, installed: true, reused: true };\n      throw new Error('An unqualified or incompatible Nasiko executable or receipt already exists at the destination.');\n    }\n    const retrieve = dependencies.fetchBytes || fetchBytes;\n    const manifestBytes = await retrieve(`${REGISTRY_ORIGIN}/v2/${REPOSITORY}/manifests/${release.manifestDigest}`, { accept: 'application/vnd.oci.image.manifest.v1+json', maxBytes: MAX_MANIFEST_BYTES });\n    assertDigest(manifestBytes, release.manifestDigest, 'Nasiko manifest');\n    const layer = validateManifest(manifestBytes);\n    const archiveBytes = await retrieve(`${REGISTRY_ORIGIN}/v2/${REPOSITORY}/blobs/${layer.digest}`, { maxBytes: MAX_ARCHIVE_BYTES });\n    if (archiveBytes.length !== layer.size) throw new Error('Nasiko archive size mismatch.');\n    assertDigest(archiveBytes, layer.digest, 'Nasiko archive');\n    const binary = (dependencies.extractBinary || extractQualifiedTarGzip)(archiveBytes, release.binaryName);\n    assertDigest(binary, release.binaryDigest, 'Nasiko binary');\n    if (dependencies.beforePublish) dependencies.beforePublish(destination);\n    const descriptor = fs.openSync(destination, 'wx', 0o700);\n    destinationOwned = true;\n    try {\n      fs.writeFileSync(descriptor, binary);\n      fs.fsyncSync(descriptor);\n      if (fs.fstatSync(descriptor).size !== binary.length) throw new Error('Published Nasiko binary size mismatch.');\n    } finally { fs.closeSync(descriptor); }","sourceCodeStart":380,"sourceCodeEnd":416,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/lib/nasiko-release.js#L380-L416","documentation":"Thrown by installNasiko when the destination path already contains a Nasiko executable/receipt that is either not the qualified pinned build or whose recorded version differs from the requested version. The installer refuses to overwrite an existing file it cannot verify, so it aborts instead of clobbering. An exact version match that is qualified is silently reused.","triggerScenarios":"Calling installNasiko when inspectInstalledNasiko(destination).installed is true and either existing.qualified is false (file present but digest/qualification check failed) or existing.version !== version (different version already installed).","commonSituations":"A stale Nasiko binary left over from a previous install or manual download; upgrading Nasiko in place without uninstalling the old version first; a corrupted or user-modified binary that no longer passes qualification; reinstalling after a partial/unqualified bootstrap.","solutions":["Run the Nasiko uninstall flow (with --yes) for the destination to remove the unqualified or mismatched executable, then reinstall.","Install the version already present at the destination (pass the existing version) so the installer takes the reuse path.","Manually remove the destination file and its metadata receipt (metadataPathFor(destination)) and retry the install.","Verify the binary was not modified after install (chmod/rename/truncate breaks qualification) and restore it from a clean source."],"exampleFix":"// before\nawait installNasiko({ version: 'v0.2.0' }); // throws: v0.1.0 already at destination\n// after\nawait uninstallNasiko({ version: 'v0.1.0', yes: true });\nawait installNasiko({ version: 'v0.2.0' });","handlingStrategy":"validation","validationCode":"import { inspectInstalledNasiko } from './nasiko-release.js';\nconst status = inspectInstalledNasiko(destination);\nif (status.installed && (!status.qualified || status.version !== desiredVersion)) {\n  await uninstallNasiko({ version: status.version, yes: true });\n}","typeGuard":"function isCleanDestination(destination, version) {\n  const s = inspectInstalledNasiko(destination);\n  return !s.installed || (s.qualified && s.version === version);\n}","tryCatchPattern":"try {\n  await installNasiko({ version });\n} catch (e) {\n  if (e.message.includes('already exists at the destination')) {\n    await uninstallNasiko({ yes: true });\n    await installNasiko({ version });\n  } else throw e;\n}","preventionTips":["Always uninstall the old version before installing a new one","Never hand-edit or patch the installed binary after install","Use the reuse path when the desired version is already installed","Check inspectInstalledNasiko before calling install"],"tags":["install","version-conflict","file-already-exists"],"backgroundTag":"file-already-exists","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"}