{"record":{"id":"e0d00b4512aa356a","repo":"deepseek-ai/deepseek-harness","slug":"invalid-view-range-it-should-be-a-list-of-two-i","errorCode":null,"errorMessage":"Invalid `view_range`. It should be a list of two integers.","messagePattern":"Invalid `view_range`\\. It should be a list of two integers\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/fs/tool-str-replace-editor/src/index.ts","lineNumber":155,"sourceCode":"  path: string,\n  content: string,\n  maxOutputChars: number,\n  viewRange?: number[],\n): string {\n  const allLines = content.split('\\n')\n  let lines = allLines\n  let initialLine = 1\n  let finalLine: number | undefined\n  let prompt = `Here's the content of ${path} with line numbers (which has a total of ${allLines.length} lines)`\n  if (viewRange !== undefined) {\n    const [requestedInitialLine, requestedFinalLine] = viewRange\n    if (\n      viewRange.length !== 2\n      || requestedInitialLine === undefined\n      || requestedFinalLine === undefined\n      || !viewRange.every(Number.isInteger)\n    ) {\n      throw new Error('Invalid `view_range`. It should be a list of two integers.')\n    }\n    initialLine = requestedInitialLine\n    finalLine = requestedFinalLine\n    if (initialLine < 1 || initialLine > allLines.length) {\n      throw new Error(\n        `Invalid \\`view_range\\`: [${viewRange.join(', ')}]. Its first element \\`${initialLine}\\` should be within the range of lines of the file: [1, ${allLines.length}]`,\n      )\n    }\n    if (finalLine > allLines.length) {\n      throw new Error(\n        `Invalid \\`view_range\\`: [${viewRange.join(', ')}]. Its second element \\`${finalLine}\\` should be smaller than the number of lines in the file: \\`${allLines.length}\\``,\n      )\n    }\n    if (finalLine !== -1 && finalLine < initialLine) {\n      throw new Error(\n        `Invalid \\`view_range\\`: [${viewRange.join(', ')}]. Its second element \\`${finalLine}\\` should be larger or equal than its first \\`${initialLine}\\``,\n      )\n    }","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/fs/tool-str-replace-editor/src/index.ts#L137-L173","documentation":"Shape guard on the optional view_range argument in formatFileView: the array is not exactly two integers (wrong length or non-integer elements). It fires while formatting the view, before any range-boundary checks; the view_range input is at fault.","triggerScenarios":"Thrown at packages/fs/tool-str-replace-editor/src/index.ts:155 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass view_range as [startLine, endLine] with two integers","Omit view_range to view the whole file"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}