Skip to content

Conversation

@ralfschimmel
Copy link

Summary

Fix crash when transforming issues that contain comments with user: null.

Problem

When running linearis issues update (or read) on an issue that has comments created by Linear's Agent Protocol, the CLI crashes with:

Cannot read properties of null (reading 'id')

Stack trace:

TypeError: Cannot read properties of null (reading 'id')
    at GraphQLIssuesService.doTransformIssueData (graphql-issues-service.js:577:38)

Root Cause

Linear's Agent Protocol creates system comments (e.g., "This thread is for an agent session with bobbin.") where user is null. The transform code at line 889-892 assumes comment.user always exists:

user: {
  id: comment.user.id,      // Fails when comment.user is null
  name: comment.user.name,
},

Example Data That Fails

From the raw API response, these comments have user: null:

{
  "id": "ec4c235a-f2f3-4650-abfa-587bb51610ef",
  "body": "This thread is for an agent session with bobbin.",
  "createdAt": "2025-12-28T12:13:47.400Z",
  "updatedAt": "2025-12-28T12:18:06.594Z",
  "user": null
}

Fix

  1. Made user optional in LinearComment interface (user?: instead of user:)
  2. Added null-check in transform, following the same pattern used for assignee:
user: comment.user
  ? {
      id: comment.user.id,
      name: comment.user.name,
    }
  : undefined,

Testing

After the fix, issues with agent protocol comments are processed correctly. Comments with null users simply omit the user field in the output.

🤖 Generated with Claude Code

Linear's agent protocol can create system comments with user: null.
Add null-check to prevent "Cannot read properties of null" error
when transforming issues with such comments.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant