{"record":{"id":"72d1644325aa1201","repo":"deepseek-ai/deepseek-harness","slug":"toolorder-must-contain-the-tool-order-rest-re","errorCode":null,"errorMessage":"toolOrder must contain the \"${TOOL_ORDER_REST}\" rest entry (where unlisted tools are inserted)","messagePattern":"toolOrder must contain the \"(.+?)\" rest entry \\(where unlisted tools are inserted\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/system-prompt/src/index.ts","lineNumber":154,"sourceCode":"/** A complete `{{...}}` reference group at the scan position (validated after). */\nconst GROUP_AT = /^\\{\\{([^{}]*)\\}\\}/\n\n/** Reserved {@link Config.toolOrder} marker for unlisted tools. */\nexport const TOOL_ORDER_REST = '<unlisted-tools>'\n\n/**\n * Validate duplicate names and the required {@link TOOL_ORDER_REST} marker.\n * Registered names are checked later because plugins have not loaded yet.\n */\nfunction validateToolOrder(toolOrder: string[] | undefined): string[] | undefined {\n  if (toolOrder === undefined) return undefined\n  const seen = new Set<string>()\n  for (const name of toolOrder) {\n    if (seen.has(name)) throw new Error(`toolOrder lists \"${name}\" more than once`)\n    seen.add(name)\n  }\n  if (!seen.has(TOOL_ORDER_REST)) {\n    throw new Error(`toolOrder must contain the \"${TOOL_ORDER_REST}\" rest entry (where unlisted tools are inserted)`)\n  }\n  return toolOrder\n}\n\n/**\n * Apply configured tool order, inserting unlisted tools lexicographically at\n * {@link TOOL_ORDER_REST}. Unknown configured names fail; known but restricted\n * names may be absent.\n */\nfunction orderTools(tools: ToolSchema[], toolOrder: string[] | undefined, knownNames: ReadonlySet<string>): ToolSchema[] {\n  const reserved = tools.find(tool => tool.name === TOOL_ORDER_REST)\n  if (reserved !== undefined) {\n    throw new Error(`tool provider returned reserved tool name \"${TOOL_ORDER_REST}\" (reserved for toolOrder's rest entry)`)\n  }\n  if (toolOrder === undefined) return tools.sort(compareToolNames)\n  const unknown = toolOrder.filter(name => name !== TOOL_ORDER_REST && !knownNames.has(name))\n  if (unknown.length > 0) {\n    throw new Error(`toolOrder lists unregistered tool${unknown.length > 1 ? 's' : ''} ${unknown.map(name => `\"${name}\"`).join(', ')}; known tools: ${[...knownNames].sort().join(', ') || '(none)'}`)","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/core/system-prompt/src/index.ts#L136-L172","documentation":"Error \"toolOrder must contain the \"${TOOL_ORDER_REST}\" rest entry (where unlisted tools are inserted)\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/core/system-prompt/src/index.ts:154 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"}