{"record":{"id":"ad658a014c7d4699","repo":"deepseek-ai/deepseek-harness","slug":"dynamic-package-half-failed-to-parse-conte","errorCode":null,"errorMessage":"dynamic package `${half}` failed to parse:\n${context}\nNote: it runs as the BODY of an async function (line numbers are offset by the 1-line wrapper). Check bracket balance — ending the returned plugin object with `});` closes a call that was never opened; a plain `return { … }` ends with `}` (an optional `;`), never `).","messagePattern":"dynamic package `(.+?)` failed to parse:\n(.+?)\nNote: it runs as the BODY of an async function \\(line numbers are offset by the 1-line wrapper\\)\\. Check bracket balance — ending the returned plugin object with `\\}\\);` closes a call that was never opened; a plain `return (.+?)` ends with `\\}` \\(an optional `;`\\), never `\\)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/extensions/cordis-host-runner/src/sandbox.ts","lineNumber":220,"sourceCode":" * Node host its failure carries the source-line-and-caret prelude the\n * teaching text builds on, and where the vm is a stub the message stays bare.\n * The two parsers' syntax faces differ at the margin (`new.target` parses in\n * a function body but not at the vm wrapper's top level), an accepted cost of\n * a vm-free gate; and under a page CSP without `'unsafe-eval'`, `new Function`\n * throws `EvalError`, which propagates unwrapped.\n * @param code - the model-written function body.\n * @param half - which define argument carried it, for the error text.\n * @throws when the body does not parse, with the offending line and a teaching hint.\n */\nexport function precheckCode(code: string, half: 'code.host' | 'code.client'): void {\n  const wrapped = `(async () => {\\n${code}\\n})()`\n  try {\n    // Compile-only: constructing the function parses the source and runs nothing.\n    // oxlint-disable-next-line typescript/no-implied-eval -- parse gate over model-written code; nothing is invoked\n    new Function(wrapped)\n  } catch (error) {\n    if (!isSyntaxError(error)) throw error\n    throw new Error(parseErrorMessage(half, prettyParseContext(wrapped, half, error)))\n  }\n}\n\n/**\n * Best-effort vm recompile of a body `new Function` already refused, for the\n * source-line-and-caret prelude only.\n * @param wrapped - the wrapped source that failed to parse.\n * @param half - which define argument carried it, for the vm filename.\n * @param refusal - the gate's own `SyntaxError`, the fallback context source.\n * @returns the vm prelude when a real vm produced one, else the bare refusal.\n */\nfunction prettyParseContext(wrapped: string, half: 'code.host' | 'code.client', refusal: Error): string {\n  try {\n    new Script(wrapped, { filename: `cordis-dyn-${half}.js` })\n  } catch (vmError) {\n    if (isSyntaxError(vmError)) return syntaxErrorContext(vmError)\n    // A stubbed vm (the browser worker) refuses Script itself; the gate's\n    // error is the only context there is.","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/extensions/cordis-host-runner/src/sandbox.ts#L202-L238","documentation":"Error \"dynamic package `${half}` failed to parse:\n${context}\nNote: it runs as the BODY of an async function (line numbers are offset by the 1-line wrapper). Check bracket balance — ending the returned plugin object with `});` closes a call that was never opened; a plain `return { … }` ends with `}` (an optional `;`), never `).\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/extensions/cordis-host-runner/src/sandbox.ts:220 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}