paperclipai/paperclip · error · Error
Expected ${expectedName}@${OPENCODE_VERSION}, received ${Str
Error message
Expected ${expectedName}@${OPENCODE_VERSION}, received ${String(packageJson.name)}@${String(packageJson.version)} What it means
assertPackage validates that a materialized package root matches the expected package name and the pinned OPENCODE_VERSION. If package.json's name or version differs, pinned-binary materialization aborts because the source would not be the exact pinned OpenCode build.
Source
Thrown at packages/paperclip-runner/scripts/materialize-opencode-binary.mjs:33
const OPENCODE_VERSION = "1.18.29";
const BASELINE_PACKAGE = "opencode-linux-x64-baseline";
function readPackage(path) {
return JSON.parse(readFileSync(path, "utf8"));
}
function sha256(path) {
return createHash("sha256").update(readFileSync(path)).digest("hex");
}
function assertPackage(packageRoot, expectedName) {
const packageJson = readPackage(join(packageRoot, "package.json"));
if (
packageJson.name !== expectedName ||
packageJson.version !== OPENCODE_VERSION
) {
throw new Error(
`Expected ${expectedName}@${OPENCODE_VERSION}, received ${String(packageJson.name)}@${String(packageJson.version)}`,
);
}
}
export function materializePinnedOpenCodeBinary(options = {}) {
const platform = options.platform ?? process.platform;
const architecture = options.architecture ?? process.arch;
if (platform !== "linux" || architecture !== "x64") {
throw new Error(
`Pinned OpenCode materialization requires linux/x64, received ${platform}/${architecture}`,
);
}
const packageRoot = realpathSync(
options.packageRoot ??
resolve(import.meta.dirname, "../node_modules/opencode-ai"),
);View on GitHub (pinned to 01ad858492)
Solutions
- Check 'cat <packageRoot>/package.json' and align it to OPENCODE_VERSION, e.g. 'pnpm add opencode-ai@<OPENCODE_VERSION>'.
- If OPENCODE_VERSION was intentionally bumped, update the OPENCODE_VERSION constant in materialize-opencode-binary.mjs and the dependency in the same commit.
- Verify the script is pointed at the opencode-ai package root, not BASELINE_PACKAGE or another package.
- Pin the dependency to an exact version (no ^ or ~) and use --frozen-lockfile in CI.
Example fix
// before "opencode-ai": "^1.0.0" // after "opencode-ai": "1.0.0" // exact pin matching OPENCODE_VERSION
Defensive patterns
Strategy: validation
Validate before calling
const pkg = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8'));
if (pkg.name !== 'opencode-ai' || pkg.version !== OPENCODE_VERSION) {
throw new Error(`pin drift: ${pkg.name}@${pkg.version} != opencode-ai@${OPENCODE_VERSION}`);
} Type guard
function isPinnedOpencode(pkgJson, expectedName, expectedVersion) {
return pkgJson?.name === expectedName && pkgJson?.version === expectedVersion;
} Try / catch
try {
materializePinnedOpenCodeBinary();
} catch (err) {
if (String(err.message).startsWith('Expected opencode-ai@')) {
execSync(`pnpm add opencode-ai@${OPENCODE_VERSION} --save-exact`);
materializePinnedOpenCodeBinary();
} else throw err;
} Prevention
- Pin opencode-ai with an exact version (no ^ or ~) in package.json.
- Keep the OPENCODE_VERSION constant and the dependency spec in sync in the same commit.
- Use --frozen-lockfile in CI to surface pin drift early.
- Never point the script at arbitrary package roots.
When it happens
Trigger: Calling assertPackage (directly or via materializePinnedOpenCodeBinary) with a packageRoot whose package.json has a different name than expectedName or whose version is not exactly OPENCODE_VERSION, e.g. after a lockfile update installed a newer opencode-ai.
Common situations: Dependency drift from a semver range pulling a newer release; the script pointed at the wrong package root; OPENCODE_VERSION was bumped without updating installed dependencies.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Anthropic did not return a usable pinned Agent version
- request.managedProfile.betaVersion is not qualified
- request.managedProfile.agentVersion must be a canonical posi
- unsupported request schema
- ${entrypoint.name} bundle retained a non-builtin import: ${d
AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-09-10).
Data as JSON: /api/errors/1ab56d3c18ec30d6.
Report an issue: GitHub.