{"record":{"id":"60bd566068e9b4f7","repo":"n8n-io/n8n","slug":"invalid-line-number-line-file-has-maxline-l","errorCode":null,"errorMessage":"Invalid line number ${line}. File has ${maxLine} lines (valid range: 0-${maxLine}).","messagePattern":"Invalid line number (.+?)\\. File has (.+?) lines \\(valid range: 0-(.+?)\\)\\.","errorType":"validation","errorClass":"InvalidLineNumberError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/ai-utilities/src/utils/text-editor.ts","lineNumber":339,"sourceCode":"\t\t\tpath,\n\t\t\tsupportedPath,\n\t\t\tthis.options.invalidPathMessage?.(path, supportedPath),\n\t\t);\n\t}\n\n\tprivate handleView(command: ViewCommand): string {\n\t\tif (this.text === null) {\n\t\t\tthrow this.createFileNotFoundError();\n\t\t}\n\n\t\tconst lines = this.text.split('\\n');\n\n\t\tif (command.view_range) {\n\t\t\tconst [start, rawEnd] = command.view_range;\n\t\t\tconst end = rawEnd === -1 ? lines.length : rawEnd;\n\n\t\t\tif (start < 1 || start > lines.length) {\n\t\t\t\tthrow new InvalidLineNumberError(start, lines.length);\n\t\t\t}\n\t\t\tif (end < start) {\n\t\t\t\tthrow new InvalidViewRangeError(start, end, lines.length);\n\t\t\t}\n\n\t\t\tconst startIndex = start - 1;\n\t\t\tconst endIndex = Math.min(end, lines.length);\n\t\t\tconst selectedLines = lines.slice(startIndex, endIndex);\n\n\t\t\treturn selectedLines.map((line, i) => `${startIndex + i + 1}: ${line}`).join('\\n');\n\t\t}\n\n\t\treturn formatTextWithLineNumbers(this.text);\n\t}\n\n\tprivate handleCreate(command: CreateCommand): string {\n\t\tthis.text = command.file_text;\n\t\treturn 'File created successfully.';","sourceCodeStart":321,"sourceCodeEnd":357,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/ai-utilities/src/utils/text-editor.ts#L321-L357","documentation":"Error \"Invalid line number ${line}. File has ${maxLine} lines (valid range: 0-${maxLine}).\" thrown in n8n-io/n8n.","triggerScenarios":"Thrown at packages/@n8n/ai-utilities/src/utils/text-editor.ts:339 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":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}