Sample
chromium-bidi 2.1.2: InvalidArgumentException
Verified sample for npm chromium-bidi 2.1.2: InvalidArgumentException. The contract ran on node 22 · linux alpine/x64 · docker and passed.
sha256:7801f2013cc3ae1775b3198196d411376908a03160bb217e53d8af3c7a58647f
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-27 |
Case
HOW- Goal
- verify chromium-bidi.InvalidArgumentException in pkg:npm/chromium-bidi@2.1.2
- Packages
- Symbols
-
- chromium-bidi.InvalidArgumentException
- Environment
- node 22.23.2
- Created
- 2026-08-27T10:57:44Z
Contract
- InvalidArgumentException instantiates with error code 'invalid argument' and provided message
- InvalidArgumentException supports optional stacktrace parameter preserving stack string
- InvalidArgumentException inherits from Exception and JavaScript built-in Error
- InvalidArgumentException.toErrorResponse formats error response object with type, id, error, message, and stacktrace
Files
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- test/contract.mjs
Source
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify chromium-bidi.InvalidArgumentException in pkg:npm/chromium-bidi@2.1.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/chromium-bidi@2.1.2
Demonstrate these symbols/APIs:
- chromium-bidi.InvalidArgumentException
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: esm
- packageManager: npm@10.9.8
- runtime: node@22.23.2
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:3232ec1fc59ab6bf1fa6c7c93e009712b4f1e866778ed3641828d4fba8875d65","constraints":{"executionContext":"node"},"contract":["InvalidArgumentException instantiates with error code 'invalid argument' and provided message","InvalidArgumentException supports optional stacktrace parameter preserving stack string","InvalidArgumentException inherits from Exception and JavaScript built-in Error","InvalidArgumentException.toErrorResponse formats error response object with type, id, error, message, and stacktrace"],"goal":"verify chromium-bidi.InvalidArgumentException in pkg:npm/chromium-bidi@2.1.2","kind":"HOW","packages":["pkg:npm/chromium-bidi@2.1.2"],"schemaVersion":1,"symbols":["chromium-bidi.InvalidArgumentException"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"esm","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/chromium-bidi@2.1.2"],"schemaVersion":1,"subject":"pkg:npm/chromium-bidi@2.1.2","symbols":["chromium-bidi.InvalidArgumentException"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-chromium-bidi-invalid-argument",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-chromium-bidi-invalid-argument",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"chromium-bidi": "2.1.2"
}
},
"node_modules/chromium-bidi": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-2.1.2.tgz",
"integrity": "sha512-vtRWBK2uImo5/W2oG6/cDkkHSm+2t6VHgnj+Rcwhb0pP74OoUb4GipyRX/T/y39gYQPhioP0DPShn+A7P6CHNw==",
"license": "Apache-2.0",
"dependencies": {
"mitt": "^3.0.1",
"zod": "^3.24.1"
},
"peerDependencies": {
"devtools-protocol": "*"
}
},
"node_modules/devtools-protocol": {
"version": "0.0.1686980",
"resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1686980.tgz",
"integrity": "sha512-NnnxGO1/cRffXL29DqGysbfgCcsYoIxprtmXgh+UDXFvhTwhRBewcRdGlEXvc3cmROi04JRmd2PqCURsijW25A==",
"license": "BSD-3-Clause",
"peer": true
},
"node_modules/mitt": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz",
"integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==",
"license": "MIT"
},
"node_modules/zod": {
"version": "3.25.76",
"resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/colinhacks"
}
}
}
}
{
"name": "sample-chromium-bidi-invalid-argument",
"version": "1.0.0",
"private": true,
"type": "module",
"description": "Clean-room verification sample for chromium-bidi InvalidArgumentException",
"main": "src/index.mjs",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"chromium-bidi": "2.1.2"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify chromium-bidi.InvalidArgumentException in pkg:npm/chromium-bidi@2.1.2",
"kind": "HOW",
"packages": [
"pkg:npm/chromium-bidi@2.1.2"
],
"symbols": [
"chromium-bidi.InvalidArgumentException"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "esm",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
import { InvalidArgumentException, Exception } from 'chromium-bidi/lib/esm/protocol/ErrorResponse.js';
/**
* Creates an InvalidArgumentException with the given message and optional stacktrace.
* @param {string} message
* @param {string} [stacktrace]
* @returns {InvalidArgumentException}
*/
export function createInvalidArgumentException(message, stacktrace) {
return new InvalidArgumentException(message, stacktrace);
}
/**
* Formats an exception into a WebDriver BiDi error response payload.
* @param {InvalidArgumentException|Exception} exception
* @param {number} commandId
* @returns {{type: string, id: number, error: string, message: string, stacktrace?: string}}
*/
export function formatErrorResponse(exception, commandId) {
return exception.toErrorResponse(commandId);
}
/**
* Validates a positive integer parameter, throwing an InvalidArgumentException if invalid.
* @param {unknown} value
* @param {string} paramName
* @returns {number}
*/
export function validatePositiveInteger(value, paramName) {
if (typeof value !== 'number' || !Number.isInteger(value) || value <= 0) {
throw new InvalidArgumentException(`Parameter '${paramName}' must be a positive integer, got: ${value}`);
}
return value;
}
/**
* Checks if the given value is an InvalidArgumentException.
* @param {unknown} err
* @returns {boolean}
*/
export function isInvalidArgumentException(err) {
return err instanceof InvalidArgumentException;
}
/**
* Checks if the given value is an Exception instance.
* @param {unknown} err
* @returns {boolean}
*/
export function isException(err) {
return err instanceof Exception;
}
export { InvalidArgumentException, Exception };
import assert from 'node:assert';
import {
InvalidArgumentException,
Exception,
createInvalidArgumentException,
formatErrorResponse,
validatePositiveInteger,
isInvalidArgumentException,
isException,
} from '../src/index.mjs';
// 1. InvalidArgumentException instantiates with error code 'invalid argument' and provided message
const ex1 = new InvalidArgumentException('Missing required parameter: contextId');
assert.strictEqual(ex1.error, 'invalid argument', "error property must be 'invalid argument'");
assert.strictEqual(ex1.message, 'Missing required parameter: contextId', 'message must match constructor input');
assert.strictEqual(ex1.stacktrace, undefined, 'stacktrace should be undefined when omitted');
const ex1Helper = createInvalidArgumentException('Invalid browsing context');
assert.strictEqual(ex1Helper.error, 'invalid argument');
assert.strictEqual(ex1Helper.message, 'Invalid browsing context');
assert.strictEqual(ex1Helper.stacktrace, undefined);
// 2. InvalidArgumentException supports optional stacktrace parameter preserving stack string
const dummyTrace = 'Error: Invalid\n at test (/app/test.js:10:5)';
const ex2 = new InvalidArgumentException('Invalid viewport dimensions', dummyTrace);
assert.strictEqual(ex2.error, 'invalid argument');
assert.strictEqual(ex2.message, 'Invalid viewport dimensions');
assert.strictEqual(ex2.stacktrace, dummyTrace, 'stacktrace must preserve the provided stack string');
const ex2Helper = createInvalidArgumentException('Custom error with trace', dummyTrace);
assert.strictEqual(ex2Helper.stacktrace, dummyTrace);
// 3. InvalidArgumentException inherits from Exception and JavaScript built-in Error
assert.strictEqual(ex1 instanceof InvalidArgumentException, true, 'must be an instance of InvalidArgumentException');
assert.strictEqual(ex1 instanceof Exception, true, 'must be an instance of Exception');
assert.strictEqual(ex1 instanceof Error, true, 'must be an instance of Error');
assert.strictEqual(isInvalidArgumentException(ex1), true, 'helper must identify InvalidArgumentException');
assert.strictEqual(isException(ex1), true, 'helper must identify Exception');
assert.strictEqual(isInvalidArgumentException(new Error('generic')), false, 'generic Error is not InvalidArgumentException');
// 4. InvalidArgumentException.toErrorResponse formats error response object with type, id, error, message, and stacktrace
const response1 = ex1.toErrorResponse(101);
assert.deepStrictEqual(response1, {
type: 'error',
id: 101,
error: 'invalid argument',
message: 'Missing required parameter: contextId',
stacktrace: undefined,
}, 'toErrorResponse should format response without stacktrace');
const response2 = formatErrorResponse(ex2, 202);
assert.deepStrictEqual(response2, {
type: 'error',
id: 202,
error: 'invalid argument',
message: 'Invalid viewport dimensions',
stacktrace: dummyTrace,
}, 'formatErrorResponse should format response including stacktrace');
// 5. Validation helper throws InvalidArgumentException on invalid inputs
assert.strictEqual(validatePositiveInteger(10, 'timeout'), 10, 'valid positive integer passes');
assert.throws(
() => validatePositiveInteger(-5, 'timeout'),
(err) => {
return (
err instanceof InvalidArgumentException &&
err.error === 'invalid argument' &&
err.message.includes("Parameter 'timeout' must be a positive integer")
);
},
'throws InvalidArgumentException on negative integer'
);
assert.throws(
() => validatePositiveInteger('invalid', 'count'),
(err) => {
return (
err instanceof InvalidArgumentException &&
err.error === 'invalid argument' &&
err.message.includes("Parameter 'count' must be a positive integer")
);
},
'throws InvalidArgumentException on non-number'
);
console.log('Contract tests passed successfully.');
Origin Seeder
anonymous