{"record":{"id":"40f8dac9e708bf42","repo":"deepseek-ai/deepseek-harness","slug":"invalid-view-range-viewrange-join-i","errorCode":null,"errorMessage":"Invalid `view_range`: [${viewRange.join(', ')}]. Its first element `${initialLine}` should be within the range of lines of the file: [1, ${allLines.length}]","messagePattern":"Invalid `view_range`: \\[(.+?)\\]\\. Its first element `(.+?)` should be within the range of lines of the file: \\[1, (.+?)\\]","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/fs/tool-str-replace-editor/src/index.ts","lineNumber":160,"sourceCode":"  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    }\n    lines = finalLine === -1\n      ? allLines.slice(initialLine - 1)\n      : allLines.slice(initialLine - 1, finalLine)\n    prompt += ` with view_range=[${initialLine}, ${finalLine}]`\n  }","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/fs/tool-str-replace-editor/src/index.ts#L142-L178","documentation":"Error \"Invalid `view_range`: [${viewRange.join(', ')}]. Its first element `${initialLine}` should be within the range of lines of the file: [1, ${allLines.length}]\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/fs/tool-str-replace-editor/src/index.ts:160 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"}