gemini-cli - 💡(How to fix) Fix cli breaks on certain prompts which contain code logs [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
google-gemini/gemini-cli#25972Fetched 2026-04-26 05:24:24
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
commented ×1labeled ×1mentioned ×1subscribed ×1

Error Message

Error: [vitest] No "formatTimeRange" export is defined on the "@/lib/formatTimeRange" mock. Did you forget to return it from "vi.mock"? Gemini cli throws error directly It should simply execute the prompt, this prompt contains error which my tests throw, I am just pasting those logs, which breaks cli

Root Cause

they happen because we fixed many things recently, double check if functionality is broken or tests, confirm from my first what's happening and suggest a fix which I should agree or disagree with We can run one test at a time to debug and fix them. e.g nx run cs-portal:test --testFiles=tests/int/more-events-popover-timezone.int.spec.tsx`

RAW_BUFFERClick to expand / collapse

What happened?

when I give this prompt

`when I run nx test cs-portal, folllowing test cases are failing: tests/int/more-events-popover-timezone.int.spec.tsx (3 tests | 1 failed) 60ms ❯ MoreEventsPopover timezone handling (3) ✓ renders the date header in the passed timezone 34ms ✓ renders the date header differently for a different timezone 13ms × passes issue-only development activity details to the hover tooltip 12ms

tests/int/event-calendar-month-overflow.int.spec.tsx (2 tests | 1 failed) 19ms ❯ EventCalendar month overflow config (2) × uses a fixed row cap for month view so the more-link can appear reliably 17ms

FAIL tests/int/event-calendar-month-overflow.int.spec.tsx > EventCalendar month overflow config > uses a fixed row cap for month view so the more-link can appear reliably AssertionError: expected true to be undefined

  • Expected: undefined
  • Received: true

tests/int/more-events-popover-timezone.int.spec.tsx > MoreEventsPopover timezone handling > passes issue-only development activity details to the hover tooltip Error: [vitest] No "formatTimeRange" export is defined on the "@/lib/formatTimeRange" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside:

vi.mock(import("@/lib/formatTimeRange"), async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } })

❯ src/tracker/components/MoreEventsPopover.tsx:370:34 368| const effectiveEnd = props.endTime ? (props.endTime as string) : event.end; 369| 370| const timeString = formatTimeRange(effectiveStart, effectiveEnd, timeZone); | ^ 371| const tooltipDateString = timeRangeSpansMultipleDays(effectiveStart, effectiveEnd, timeZone) 372| ? '' ❯ src/tracker/components/MoreEventsPopover.tsx:311:27 ❯ MoreEventsPopover src/tracker/components/MoreEventsPopover.tsx:291:22 ❯ Object.react_stack_bottom_frame ../../node_modules/react-dom/cjs/react-dom-client.development.js:25904:20 ❯ renderWithHooks ../../node_modules/react-dom/cjs/react-dom-client.development.js:7662:22 ❯ updateFunctionComponent ../../node_modules/react-dom/cjs/react-dom-client.development.js:10166:19

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/9]⎯

FAIL tests/int/task-detail-popover-edit-notes.int.spec.tsx > TaskDetailPopover notes editing > closes the parent popover when notes are saved from the editor TestingLibraryElementError: Unable to find an accessible element with the role "button" and name "Mock Save Notes"

tests/int/task-detail-popover-meeting-delete.int.spec.tsx > TaskDetailPopover meeting deletion flow > offers calendar removal after cancelling a meeting TestingLibraryElementError: Found multiple elements with the text of: Delete task

tests/int/task-detail-popover-meeting-delete.int.spec.tsx > TaskDetailPopover meeting deletion flow > renames and wires the direct calendar-only action TestingLibraryElementError: Found multiple elements with the text of: Delete task tests/int/use-calendar-preferences.int.spec.tsx > useCalendarPreferences > can still read persisted values after mount-time hydration AssertionError: expected { view: 'month', …(6) } to deeply equal { view: 'month', …(5) }

  • Expected
  • Received

@@ -1,6 +1,7 @@ {

  • "calendarTimezone": null, "date": "2026-03-16", "filters": [ "development", "development:mixed", ],

❯ tests/int/use-calendar-preferences.int.spec.tsx:72:44 70| );

they happen because we fixed many things recently, double check if functionality is broken or tests, confirm from my first what's happening and suggest a fix which I should agree or disagree with We can run one test at a time to debug and fix them. e.g nx run cs-portal:test --testFiles=tests/int/more-events-popover-timezone.int.spec.tsx`

Gemini cli throws error directly

<img width="1607" height="538" alt="Image" src="https://github.com/user-attachments/assets/869c1e96-0f15-4b6b-87f5-5178e54edd4c" />

What did you expect to happen?

It should simply execute the prompt, this prompt contains error which my tests throw, I am just pasting those logs, which breaks cli

Client information

  • CLI Version: 0.39.1
  • Git Commit: 4d73f3413
  • Session ID: a327e04a-5728-419e-88e1-b9277f42a179
  • Operating System: darwin v20.19.2
  • Sandbox Environment: no sandbox
  • Model Version: auto-gemini-3
  • Auth Type: oauth-personal
  • Memory Usage: 322.5 MB
  • Terminal Name: Unknown
  • Terminal Background: Unknown
  • Kitty Keyboard Protocol: Unsupported

Login information

No response

Anything else we need to know?

No response

extent analysis

TL;DR

The most likely fix is to update the mock for the formatTimeRange function in the @/lib/formatTimeRange module to include the missing export.

Guidance

  • Review the test failures and identify the specific issues, such as the missing formatTimeRange export and the incorrect expectations in the useCalendarPreferences test.
  • Update the mock for the formatTimeRange function to include the missing export, as suggested by the error message.
  • Verify that the useCalendarPreferences test is expecting the correct values, and update the test if necessary.
  • Run each test individually using the nx run cs-portal:test --testFiles=<test_file> command to debug and fix the issues.

Example

vi.mock('@/lib/formatTimeRange', async (importOriginal) => {
  const actual = await importOriginal();
  return {
    ...actual,
    formatTimeRange: jest.fn(), // add the missing export
  };
});

Notes

The issue is likely caused by recent changes to the codebase, and the tests need to be updated to reflect these changes. The formatTimeRange mock needs to be updated to include the missing export, and the useCalendarPreferences test needs to be verified to ensure it is expecting the correct values.

Recommendation

Apply the workaround by updating the mock for the formatTimeRange function to include the missing export, and then re-run the tests to verify that the issues are resolved.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

gemini-cli - 💡(How to fix) Fix cli breaks on certain prompts which contain code logs [1 comments, 2 participants]