NousResearch/hermes-agent · error · Error

[stage-native-deps] native binary platform mismatch (target=

Error message

[stage-native-deps] native binary platform mismatch (target=${targetPlatform}):
  ${m.file}: expected ${m.expected}, got ${m.classified ?? 'unknown'}
Refusing to stage a binary compiled for the wrong platform.

What it means

Error "[stage-native-deps] native binary platform mismatch (target=${targetPlatform}): ${m.file}: expected ${m.expected}, got ${m.classified ?? 'unknown'} Refusing to stage a binary compiled for the wrong platform." thrown in NousResearch/hermes-agent.

Source

Thrown at apps/desktop/scripts/stage-native-deps.mjs:212

  function scan(dir, relPrefix) {
    if (!existsSync(dir)) return
    for (const entry of readdirSync(dir, { withFileTypes: true })) {
      if (entry.isDirectory()) {
        scan(join(dir, entry.name), `${relPrefix}${entry.name}/`)
        continue
      }
      if (!entry.name.endsWith('.node')) continue
      const fullPath = join(dir, entry.name)
      const classified = classifyNativeBinary(fullPath)
      if (classified !== targetPlatform) {
        mismatches.push({ file: `${relPrefix}${entry.name}`, classified, expected: targetPlatform })
      }
    }
  }
  scan(join(destRoot, 'prebuilds'), 'prebuilds/')
  scan(join(destRoot, 'build', 'Release'), 'build/Release/')
  if (mismatches.length > 0) {
    throw new Error(
      `[stage-native-deps] native binary platform mismatch (target=${targetPlatform}):\n` +
        mismatches
          .map((m) => `  ${m.file}: expected ${m.expected}, got ${m.classified ?? 'unknown'}`)
          .join('\n') +
        `\nRefusing to stage a binary compiled for the wrong platform.`
    )
  }
}

/**
 * Stage node-pty's native runtime dependencies into `destRoot`.
 *
 * Exported separately from `stageNodePty` so tests can supply a fake
 * node-pty source tree without going through real module resolution.
 *
 * Strategy (fail-closed):
 *
 * 1. Copy the matching prebuild (`prebuilds/<platform>-<arch>/`) if present.

View on GitHub (pinned to c896c09c42)

Solutions

  1. Stage a binary built for the target platform (run on that platform or use a matching prebuild).
  2. Check the target platform argument matches the prebuilt binary you downloaded.

When it happens

Trigger: Thrown at apps/desktop/scripts/stage-native-deps.mjs:212 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of NousResearch/hermes-agent@c896c09c42 (2026-08-14). Data as JSON: /api/errors/28491609d1354622. Report an issue: GitHub.