Skip to content

TypeError: undefined is not an object (evaluating 'toSummarize.at(-1).info') #2559

Closed
cog-ogp-demo/opencode
#20

Description

@sahilchouksey

Description

A TypeError: undefined is not an object (evaluating 'toSummarize.at(-1).info') occurs during session summarization when attempting to create issue content.

Steps to Reproduce

  1. Trigger session summarization in scenarios where there are 0 or 1 messages after the last summary message.
  2. The error occurs at line 1826 in packages/opencode/src/session/index.ts when accessing toSummarize.at(-1).info.time.created.

Expected Behavior

Session summarization should handle cases with no messages to summarize gracefully without throwing an error.

Actual Behavior

The application throws a TypeError because toSummarize is an empty array, and at(-1) returns undefined.

Root Cause

The summarize function assumes toSummarize (a slice of messages) is non-empty, but it can be empty when msgs.length - start is 0 or 1, leading to an empty slice.

Environment

  • Platform: Linux
  • Opencode version: 0.7.3

Additional Context

This error prevents proper session compaction and interrupts user workflows

Activity

  1. github-actions commented on Sep 12, 2025

    @github-actions
    Contributor

    This issue might be a duplicate or related to existing issues. Please check:

    The error you're experiencing seems to be in the summarization logic during session compaction. While not exact duplicates, these issues all relate to problems with the compaction/summarization system.

    Feel free to ignore if none of these address your specific case.

  2. vldF commented on Sep 12, 2025

    @vldF

    I have this too

  3. thdxr commented on Sep 12, 2025

    @thdxr
    Member

    should be fixed now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions