Skip to content

[Bug] Update Check Timestamp Written Even When Version Fetch Failed #739

Closed

Description

@akramcodez

Description

In checkForUpdates(), updateLastCheckTime() is called immediately after fetchLatestVersion() regardless of whether the fetch succeeded or returned null. When fetchLatestVersion() fails (e.g., offline, npm registry down), it returns null - but the "last checked" timestamp is still written to preferences. This causes the app to skip the next scheduled update check entirely, silently preventing users who were temporarily offline from ever
seeing an update notification.

Environment

  • OS: Any
  • Node version: Any
  • Nanocoder version: Latest
  • Provider: Any
  • Model: Any

Steps to Reproduce

  1. Disconnect from the internet.
  2. Launch Nanocoder (or trigger an update check).
  3. Observe that preferences.lastUpdateCheck is updated despite the fetch failing.
  4. Reconnect to the internet.
  5. Wait for the next update check interval - no update notification appears
    because the timestamp was already written.

Expected Behavior

The "last checked" timestamp should only be updated when a valid version string is successfully returned from the npm registry.

Actual Behavior

The timestamp is updated unconditionally, even when fetchLatestVersion() returns null due to a network error.

Logs/Screenshots

N/A

Additional Context

  • Fix: wrap updateLastCheckTime() in an if (latestVersion !== null) check.
  • Note: the existing catch block on line 176 already calls updateLastCheckTime() intentionally to prevent hammering on repeated crashes - that behavior is correct and should remain unchanged.
  • Note: This issue is intentionally kept small and is suitable for first-time contributors. If you're interested in working on it, please leave a comment below and ask to be assigned before opening a pull request.
  • I have searched existing issues to ensure this is not a duplicate
  • I can reproduce this issue consistently
  • This issue occurs with the latest version of nanocoder

Activity

  1. added
    bug
    good first issue
    on Aug 1, 2026
  2. MsadafK commented on Aug 1, 2026

    @MsadafK

    Hi @akramcodez , I would like to work on this issue. Please assign it to me!

  3. DeepamJha commented on Aug 1, 2026

    @DeepamJha
    Contributor

    Hi @akramcodez, I'd like to work on this, already done similar fix in this codebase before (#729) and this looks like a good next one for me. Could you assign it to me?

  4. akramcodez commented on Aug 2, 2026

    @akramcodez
    MemberAuthor

    Hey @DeepamJha and @MsadafK, you both are already assigned to other issues. Could you please complete those first before taking on new ones? Thanks!

  5. hiarun02 commented on Aug 2, 2026

    @hiarun02
    Contributor

    Hi @akramcodez, I'd like to work on this issue, assign it to me

  6. RealBhupesh commented on Aug 2, 2026

    @RealBhupesh
    Contributor

    I would like to work on this issue. I will include a focused fix and regression coverage in a PR shortly.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions