{"record":{"id":"f52bdc47718ffc92","repo":"mastra-ai/mastra","slug":"a-multi-line-review-comment-requires-both-startlin","errorCode":null,"errorMessage":"A multi-line review comment requires both startLine and startSide.","messagePattern":"A multi-line review comment requires both startLine and startSide\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mastracode/factory/src/integrations/github/integration.ts","lineNumber":944,"sourceCode":"  }\n\n  async #createReviewComment(input: InputOf<'createReviewComment'>) {\n    const { octokit, parts } = this.#repositoryClient(input.connection, input.sourceId);\n    const pullNumber = requirePullRequestNumber(input.pullRequestId);\n    if (input.replyToId) {\n      const { data } = await octokit.pulls.createReplyForReviewComment({\n        ...parts,\n        pull_number: pullNumber,\n        comment_id: requirePositiveId(input.replyToId, 'review comment'),\n        body: input.body,\n      });\n      return parseReviewComment(data);\n    }\n    if (!input.commitId || !input.path || input.line === undefined || !input.side) {\n      throw new Error('A review comment requires commitId, path, line, and side unless it is a reply.');\n    }\n    if ((input.startLine === undefined) !== (input.startSide === undefined)) {\n      throw new Error('A multi-line review comment requires both startLine and startSide.');\n    }\n    const { data } = await octokit.pulls.createReviewComment({\n      ...parts,\n      pull_number: pullNumber,\n      body: input.body,\n      commit_id: input.commitId,\n      path: input.path,\n      line: input.line,\n      side: input.side.toUpperCase() as 'LEFT' | 'RIGHT',\n      start_line: input.startLine,\n      start_side: input.startSide?.toUpperCase() as 'LEFT' | 'RIGHT' | undefined,\n    });\n    return parseReviewComment(data);\n  }\n\n  async #updateReviewComment(input: InputOf<'updateReviewComment'>) {\n    const { octokit, parts } = this.#repositoryClient(input.connection, input.sourceId);\n    const { data } = await octokit.pulls.updateReviewComment({","sourceCodeStart":926,"sourceCodeEnd":962,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/mastracode/factory/src/integrations/github/integration.ts#L926-L962","documentation":"GitHub multi-line review comments require both startLine and startSide; the integration enforces that they are either both present or both absent, throwing on the asymmetric case (XOR of the two being undefined).","triggerScenarios":"Creating a review comment where startLine is set but startSide is undefined (or vice versa) — the API payload would be rejected by GitHub as incomplete range specification.","commonSituations":"UIs that let users pick an end line but forget the range start side; code that copies startLine from one comment template but not startSide; SIDE differences when spanning LEFT/RIGHT sides of a diff.","solutions":["Supply both startLine and startSide together when creating multi-line comments","Set neither field for single-line comments","Validate the pair (both-or-neither) at the caller before invoking the integration"],"exampleFix":"// before\nawait gh.createReviewComment({ ..., commitId, path, line: 50, side: 'RIGHT', startLine: 45 }); // startSide missing\n// after\nawait gh.createReviewComment({ ..., commitId, path, line: 50, side: 'RIGHT', startLine: 45, startSide: 'RIGHT' });","handlingStrategy":"validation","validationCode":"if ((input.startLine === undefined) !== (input.startSide === undefined)) {\n  throw new Error('multi-line review comment requires both startLine and startSide (or neither)');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await gh.createReviewComment(input);\n} catch (e) {\n  if (e.message.startsWith('A multi-line review comment requires both startLine')) {\n    // add the missing startSide/startLine or drop both for a single-line comment\n  } else throw e;\n}","preventionTips":["Group startLine/startSide into a single optional range object in your input types","Toggle both fields together in comment-form UI state","Add a shared validator used by every code path that builds review-comment payloads"],"tags":["github","validation","input"],"backgroundTag":"missing-required-field","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}