{"record":{"id":"d31f9089fbcc1ed7","repo":"deepseek-ai/deepseek-harness","slug":"malformed-prompt-variable-reference-at-text-sli","errorCode":null,"errorMessage":"malformed prompt variable reference at \"${text.slice(open, open + 16)}…\" in ${kind} \"${input.name}\" (references are complete simple {{name}} groups)","messagePattern":"malformed prompt variable reference at \"(.+?)…\" in (.+?) \"(.+?)\" \\(references are complete simple (.+?)\\} groups\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/system-prompt/src/index.ts","lineNumber":271,"sourceCode":"    .map(context => ({ name: context.name, text: interpolate(context, assembly.variables, 'context') }))\n    .filter(section => section.text.length > 0)\n}\n\n/** Interpolate one section or context and attribute diagnostics to its owning input. */\nfunction interpolate(\n  input: AssembledSection | AssembledContext,\n  variables: Record<string, string | undefined>,\n  kind: 'section' | 'context',\n): string {\n  const text = input.text\n  let result = ''\n  let last = 0\n  for (let open = text.indexOf('{{'); open >= 0; open = text.indexOf('{{', last)) {\n    const group = GROUP_AT.exec(text.slice(open))\n    if (group === null) {\n      // A later closing brace makes this malformed; otherwise it is literal prose.\n      if (text.indexOf('}}', open + 2) >= 0) {\n        throw new Error(`malformed prompt variable reference at \"${text.slice(open, open + 16)}…\" in ${kind} \"${input.name}\" (references are complete simple {{name}} groups)`)\n      }\n      result += text.slice(last, open + 2)\n      last = open + 2\n      continue\n    }\n    // `{{}}` yields an empty name and follows the malformed-reference path.\n    const name = group[0].slice(2, -2)\n    if (!VARIABLE_NAME.test(name)) {\n      throw new Error(`malformed prompt variable reference \"{{${name}}}\" in ${kind} \"${input.name}\" (variable names match ${String(VARIABLE_NAME)})`)\n    }\n    // Do not resolve unregistered names through Object.prototype.\n    if (!Object.hasOwn(variables, name)) {\n      const known = Object.keys(variables)\n      throw new Error(`unknown prompt variable \"{{${name}}}\" in ${kind} \"${input.name}\"; registered variables: ${known.length > 0 ? known.join(', ') : '(none)'}`)\n    }\n    const value = variables[name]\n    if (value === undefined) {\n      throw new Error(`prompt variable \"{{${name}}}\" has no value for this assembly (${kind} \"${input.name}\")`)","sourceCodeStart":253,"sourceCodeEnd":289,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/core/system-prompt/src/index.ts#L253-L289","documentation":"Error \"malformed prompt variable reference at \"${text.slice(open, open + 16)}…\" in ${kind} \"${input.name}\" (references are complete simple {{name}} groups)\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/core/system-prompt/src/index.ts:271 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"}