{"record":{"id":"31e59ecb21bd13cd","repo":"dotnet/BenchmarkDotNet","slug":"unable-to-determine-application-arguments-for-the","errorCode":null,"errorMessage":"Unable to determine application arguments for the current runtime.","messagePattern":"Unable to determine application arguments for the current runtime\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/BenchmarkDotNet/Templates/benchmark-main.mjs","lineNumber":44,"sourceCode":"    if (ENVIRONMENT_IS_NODE) {\n        const argv = globalThis.process.argv ?? [];\n        const sep = argv.indexOf(\"--\");\n        return sep >= 0 ? argv.slice(sep + 1) : argv.slice(2);\n    }\n\n    // v8/d8\n    if (v8args !== undefined)\n        return Array.from(v8args);\n\n    // SpiderMonkey\n    if (typeof scriptArgs !== \"undefined\")\n        return Array.from(scriptArgs);\n\n    // Windows Script Host / Chakra\n    if (typeof WScript !== \"undefined\" && WScript.Arguments)\n        return Array.from(WScript.Arguments);\n\n    throw new Error(\"Unable to determine application arguments for the current runtime.\");\n}\n\nconst args = getAppArgs();\n\n// Handle WebSocket capability probe\nif (args.includes(\"--getSupportsWebSocket\")) {\n    let supportsWebSocket = false;\n\n    // First check for native WebSocket support (browsers, some modern engines)\n    if (typeof WebSocket !== \"undefined\") {\n        supportsWebSocket = true;\n    } else {\n        // Try to import ws module (Node.js)\n        try {\n            await import(\"ws\");\n            supportsWebSocket = true;\n        } catch (e) {\n            // Neither native WebSocket nor ws module available","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/dotnet/BenchmarkDotNet/blob/b515068b61ad1c9c9aa938b8ece4af1e7d6d85a3/src/BenchmarkDotNet/Templates/benchmark-main.mjs#L26-L62","documentation":"The generated benchmark-main.mjs entry script could not find any engine-specific arguments array, so it cannot read the command-line arguments BenchmarkDotNet passes to the benchmark process.","triggerScenarios":"Thrown at src/BenchmarkDotNet/Templates/benchmark-main.mjs:44 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run the benchmark script with a supported JavaScript engine: Node.js, v8/d8, SpiderMonkey, or Windows Script Host/Chakra.","Pass arguments in the engine-specific way (process.argv for Node, arguments/v8args/scriptArgs/WScript.Arguments for the others).","If you embedded the generated script in a custom host, expose the arguments via one of the recognized globals before the script runs."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b515068b61ad1c9c9aa938b8ece4af1e7d6d85a3","analyzedAt":"2026-08-13T19:12:24.196Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}